11const { describe, it } = require ( 'node:test' ) ;
2- const should = require ( 'should ' ) ;
2+ const assert = require ( 'node:assert/strict ' ) ;
33const furkotDirections = require ( '../lib/directions' ) ;
44const { timeout } = require ( '../lib/service/util' ) ;
55
@@ -26,19 +26,19 @@ function timeService(millis, success = true) {
2626describe ( 'furkot-directions node module' , async ( ) => {
2727 await it ( 'no input' , async ( ) => {
2828 const result = await furkotDirections ( ) ( ) ;
29- should . not . exist ( result ) ;
29+ assert . strictEqual ( result , undefined ) ;
3030 } ) ;
3131
3232 await it ( 'empty input' , async ( ) => {
3333 const result = await furkotDirections ( ) ( { } ) ;
34- should . not . exist ( result ) ;
34+ assert . strictEqual ( result , undefined ) ;
3535 } ) ;
3636
3737 await it ( 'one point' , async ( ) => {
3838 const result = await furkotDirections ( ) ( {
3939 points : [ [ 0 , 0 ] ]
4040 } ) ;
41- should . not . exist ( result ) ;
41+ assert . strictEqual ( result , undefined ) ;
4242 } ) ;
4343
4444 await it ( 'no service' , async ( ) => {
@@ -50,8 +50,8 @@ describe('furkot-directions node module', async () => {
5050 [ 1 , 1 ]
5151 ]
5252 } ) ;
53- should . exist ( result ) ;
54- result . should . have . property ( ' routes' ) . with . length ( 1 ) ;
53+ assert . ok ( result ) ;
54+ assert . strictEqual ( result . routes . length , 1 ) ;
5555 } ) ;
5656
5757 await it ( 'service' , async ( ) => {
@@ -70,19 +70,19 @@ describe('furkot-directions node module', async () => {
7070 }
7171 ]
7272 } ) ( query ) ;
73- should . exist ( result ) ;
74- result . should . have . property ( ' stats' , [ 'mock' ] ) ;
75- result . should . have . property ( ' provider' , 'mock' ) ;
76- result . should . have . property ( ' name' , 'success' ) ;
77- result . should . have . property ( ' query' , query ) ;
73+ assert . ok ( result ) ;
74+ assert . deepStrictEqual ( result . stats , [ 'mock' ] ) ;
75+ assert . strictEqual ( result . provider , 'mock' ) ;
76+ assert . strictEqual ( result . name , 'success' ) ;
77+ assert . deepStrictEqual ( result . query , query ) ;
7878 } ) ;
7979
8080 await it ( 'only enabled services' , ( ) => {
8181 const options = {
8282 valhalla_enable ( ) { }
8383 } ;
8484 const directions = furkotDirections ( options ) ;
85- directions . options . should . have . property ( ' services' ) . with . length ( 1 ) ;
85+ assert . strictEqual ( directions . options . services . length , 1 ) ;
8686 } ) ;
8787
8888 await it ( 'override provider name' , ( ) => {
@@ -92,7 +92,7 @@ describe('furkot-directions node module', async () => {
9292 stadiamaps_enable ( ) { }
9393 } ;
9494 const directions = furkotDirections ( options ) ;
95- directions . options . should . have . property ( ' services' ) . with . length ( 1 ) ;
95+ assert . strictEqual ( directions . options . services . length , 1 ) ;
9696 } ) ;
9797
9898 await it ( 'timeout' , async ( ) => {
@@ -110,7 +110,9 @@ describe('furkot-directions node module', async () => {
110110 [ 1 , 1 ]
111111 ]
112112 } ) ;
113- await promise . should . be . resolvedWith ( {
113+ await assert . doesNotReject ( promise ) ;
114+ const result = await promise ;
115+ assert . deepStrictEqual ( result , {
114116 query : {
115117 points : [
116118 [ 0 , 0 ] ,
@@ -151,6 +153,6 @@ describe('furkot-directions node module', async () => {
151153 ) ;
152154 await timeout ( 15 ) ;
153155 ac . abort ( ) ;
154- await promise . should . be . rejectedWith ( / a b o r t e d / ) ;
156+ await assert . rejects ( promise , / a b o r t e d / ) ;
155157 } ) ;
156158} ) ;
0 commit comments