Skip to content

Commit

Permalink
🐛 fix: Add missing dependency and fix tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
make-github-pseudonymous-again committed Apr 28, 2020
1 parent 6f8d912 commit 734cb3b
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 220 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"url": "https://github.com/aureooms/js-codec-base32/issues"
},
"dependencies": {
"@aureooms/js-codec": "^3.0.0",
"@aureooms/js-error": "^4.0.0",
"@aureooms/js-itertools": "^3.4.0",
"@aureooms/js-mapping": "^3.1.0"
Expand Down
12 changes: 6 additions & 6 deletions test/src/decode.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ from_ascii.title = success.title ;

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

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

if ( position ) {
t.throws( ( ) => decode( bytes , options ) , CodecError ) ;
t.throws( ( ) => decode( bytes , options ) , ( error ) => error.encoding === 'base32' ) ;
t.throws( ( ) => decode( bytes , options ) , ( error ) => error.object === bytes ) ;
t.throws( ( ) => decode( bytes , options ) , ( error ) => error.position.start === position.start ) ;
t.throws( ( ) => decode( bytes , options ) , ( error ) => error.position.end === position.end ) ;
t.true( error instanceof CodecError ) ;
t.is( error.encoding , 'base32' ) ;
t.is( error.object , bytes ) ;
t.is( error.position.start , position.start ) ;
t.is( error.position.end , position.end ) ;
}

}
Expand Down
12 changes: 6 additions & 6 deletions test/src/encode.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ from_ascii.title = success.title ;

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

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

if ( position ) {
t.throws( ( ) => encode( string , options ) , CodecError ) ;
t.throws( ( ) => encode( string , options ) , ( error ) => error.encoding === 'base32' ) ;
t.throws( ( ) => encode( string , options ) , ( error ) => error.object === string ) ;
t.throws( ( ) => encode( string , options ) , ( error ) => error.position.start === position.start ) ;
t.throws( ( ) => encode( string , options ) , ( error ) => error.position.end === position.end ) ;
t.true( error instanceof CodecError ) ;
t.is( error.encoding , 'base32' ) ;
t.is( error.object , string ) ;
t.is( error.position.start , position.start ) ;
t.is( error.position.end , position.end ) ;
}

}
Expand Down
Loading

0 comments on commit 734cb3b

Please sign in to comment.