Skip to content

Commit 734cb3b

Browse files
🐛 fix: Add missing dependency and fix tests.
1 parent 6f8d912 commit 734cb3b

File tree

4 files changed

+31
-220
lines changed

4 files changed

+31
-220
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
"url": "https://github.com/aureooms/js-codec-base32/issues"
2828
},
2929
"dependencies": {
30+
"@aureooms/js-codec": "^3.0.0",
3031
"@aureooms/js-error": "^4.0.0",
3132
"@aureooms/js-itertools": "^3.4.0",
3233
"@aureooms/js-mapping": "^3.1.0"

test/src/decode.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ from_ascii.title = success.title ;
2525

2626
function failure ( t , bytes , options , ExpectedError , position ) {
2727

28-
t.throws( ( ) => decode( bytes , options ) , ExpectedError ) ;
28+
const error = t.throws( ( ) => decode( bytes , options ) , { instanceOf: ExpectedError } ) ;
2929

3030
if ( position ) {
31-
t.throws( ( ) => decode( bytes , options ) , CodecError ) ;
32-
t.throws( ( ) => decode( bytes , options ) , ( error ) => error.encoding === 'base32' ) ;
33-
t.throws( ( ) => decode( bytes , options ) , ( error ) => error.object === bytes ) ;
34-
t.throws( ( ) => decode( bytes , options ) , ( error ) => error.position.start === position.start ) ;
35-
t.throws( ( ) => decode( bytes , options ) , ( error ) => error.position.end === position.end ) ;
31+
t.true( error instanceof CodecError ) ;
32+
t.is( error.encoding , 'base32' ) ;
33+
t.is( error.object , bytes ) ;
34+
t.is( error.position.start , position.start ) ;
35+
t.is( error.position.end , position.end ) ;
3636
}
3737

3838
}

test/src/encode.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ from_ascii.title = success.title ;
2525

2626
function failure ( t , string , options , ExpectedError , position ) {
2727

28-
t.throws( ( ) => encode( string , options ) , ExpectedError ) ;
28+
const error = t.throws( ( ) => encode( string , options ) , { instanceOf: ExpectedError } ) ;
2929

3030
if ( position ) {
31-
t.throws( ( ) => encode( string , options ) , CodecError ) ;
32-
t.throws( ( ) => encode( string , options ) , ( error ) => error.encoding === 'base32' ) ;
33-
t.throws( ( ) => encode( string , options ) , ( error ) => error.object === string ) ;
34-
t.throws( ( ) => encode( string , options ) , ( error ) => error.position.start === position.start ) ;
35-
t.throws( ( ) => encode( string , options ) , ( error ) => error.position.end === position.end ) ;
31+
t.true( error instanceof CodecError ) ;
32+
t.is( error.encoding , 'base32' ) ;
33+
t.is( error.object , string ) ;
34+
t.is( error.position.start , position.start ) ;
35+
t.is( error.position.end , position.end ) ;
3636
}
3737

3838
}

0 commit comments

Comments
 (0)