This repository has been archived by the owner on Jul 9, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: replaces jest with Node.js test runner (#111)
- Loading branch information
Showing
7 changed files
with
7,376 additions
and
13,092 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 19 additions & 13 deletions
32
feature-runner/steps/device/matchDeviceBoundTopic.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,38 @@ | ||
import assert from 'node:assert' | ||
import { describe, test as it } from 'node:test' | ||
import { matchDeviceBoundTopic } from './matchDeviceBoundTopic' | ||
|
||
describe('matchTopic', () => { | ||
it('should match a simple topic', () => | ||
expect( | ||
void describe('matchTopic', () => { | ||
void it('should match a simple topic', () => | ||
assert.equal( | ||
matchDeviceBoundTopic( | ||
'devices/49dd7d86-e547-4a4d-8f0f-f4b09591838c/messages/devicebound', | ||
'devices/49dd7d86-e547-4a4d-8f0f-f4b09591838c/messages/devicebound', | ||
), | ||
).toEqual(true)) | ||
it('should match topic with a property bag', () => | ||
expect( | ||
true, | ||
)) | ||
void it('should match topic with a property bag', () => | ||
assert.equal( | ||
matchDeviceBoundTopic( | ||
'devices/49dd7d86-e547-4a4d-8f0f-f4b09591838c/messages/devicebound/pgps=result', | ||
'devices/49dd7d86-e547-4a4d-8f0f-f4b09591838c/messages/devicebound/%24.to=%2Fdevices%2F49dd7d86-e547-4a4d-8f0f-f4b09591838c%2Fmessages%2Fdevicebound&pgps=result&%24.ct=application%2Fjson&%24.ce=utf-8', | ||
), | ||
).toEqual(true)) | ||
it('should not match topic with a property bag thats not contained', () => | ||
expect( | ||
true, | ||
)) | ||
void it('should not match topic with a property bag thats not contained', () => | ||
assert.equal( | ||
matchDeviceBoundTopic( | ||
'devices/49dd7d86-e547-4a4d-8f0f-f4b09591838c/messages/devicebound/agps=result', | ||
'devices/49dd7d86-e547-4a4d-8f0f-f4b09591838c/messages/devicebound/%24.to=%2Fdevices%2F49dd7d86-e547-4a4d-8f0f-f4b09591838c%2Fmessages%2Fdevicebound&pgps=result&%24.ct=application%2Fjson&%24.ce=utf-8', | ||
), | ||
).toEqual(false)) | ||
it('should match a topic regardless of property bag', () => | ||
expect( | ||
false, | ||
)) | ||
void it('should match a topic regardless of property bag', () => | ||
assert.equal( | ||
matchDeviceBoundTopic( | ||
'devices/49dd7d86-e547-4a4d-8f0f-f4b09591838c/messages/devicebound', | ||
'devices/49dd7d86-e547-4a4d-8f0f-f4b09591838c/messages/devicebound/%24.to=%2Fdevices%2F49dd7d86-e547-4a4d-8f0f-f4b09591838c%2Fmessages%2Fdevicebound&pgps=result&%24.ct=application%2Fjson&%24.ce=utf-8', | ||
), | ||
).toEqual(true)) | ||
true, | ||
)) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,14 @@ | ||
import assert from 'node:assert' | ||
import { describe, test as it } from 'node:test' | ||
import { lowerCaseRecord } from './lowerCaseRecord' | ||
|
||
describe('lowerCaseRecord', () => { | ||
it('should lower-case all keys', () => | ||
expect( | ||
void describe('lowerCaseRecord', () => { | ||
void it('should lower-case all keys', () => | ||
assert.deepStrictEqual( | ||
lowerCaseRecord({ | ||
Foo: 'Bar', // will be overwritten by the next key | ||
foo: 'bar', | ||
}), | ||
).toMatchObject({ foo: 'bar' })) | ||
{ foo: 'bar' }, | ||
)) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,13 @@ | ||
import assert from 'node:assert' | ||
import { describe, test as it } from 'node:test' | ||
import { sortQueryString } from './sortQueryString' | ||
|
||
describe('sortQueryString', () => { | ||
it('should sort the query part of a mock URL', () => | ||
expect( | ||
void describe('sortQueryString', () => { | ||
void it('should sort the query part of a mock URL', () => | ||
assert.deepStrictEqual( | ||
sortQueryString( | ||
'api.nrfcloud.com/v1/location/agps?eci=73393515&tac=132&requestType=custom&mcc=397&mnc=73&customTypes=2', | ||
), | ||
).toEqual( | ||
'api.nrfcloud.com/v1/location/agps?customTypes=2&eci=73393515&mcc=397&mnc=73&requestType=custom&tac=132', | ||
)) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,18 @@ | ||
import assert from 'node:assert' | ||
import { describe, test as it } from 'node:test' | ||
import { splitMockResponse } from './splitMockResponse' | ||
|
||
describe('split mock response', () => { | ||
it('should parse headers and body', () => | ||
expect( | ||
void describe('split mock response', () => { | ||
void it('should parse headers and body', () => | ||
assert.deepStrictEqual( | ||
splitMockResponse(`Content-Type: application/octet-stream | ||
(binary A-GPS data) other types`), | ||
).toMatchObject({ | ||
headers: { | ||
'Content-Type': 'application/octet-stream', | ||
{ | ||
headers: { | ||
'Content-Type': 'application/octet-stream', | ||
}, | ||
body: '(binary A-GPS data) other types', | ||
}, | ||
body: '(binary A-GPS data) other types', | ||
})) | ||
)) | ||
}) |
Oops, something went wrong.