import * as _sodium from 'libsodium-wrappers-sumo' ; import * as bazinga64 from './index' ; let sodium ; describe ( 'decode Base64' , ( ) => { beforeAll ( async ( ) => { await _sodium . ready ; sodium = _sodium ; } ) ; it ( 'is compliant with libsodium on short sequences' , ( ) => { const encoded = 'SGVsbG8=' ; const decodedWithBazinga64 = bazinga64 . Decoder . fromBase64 ( encoded ) . asBytes ; const decodedWithSodium = sodium . from_base64 ( encoded , sodium . base64_variants . ORIGINAL ) ; expect ( decodedWithBazinga64 ) . toEqual ( decodedWithSodium ) ; } ) ; it ( 'is compliant with libsodium on long sequences' , ( ) => { const encoded = 'pQABARn//wKhAFgg5fwzzahXsFp99ChcRC0/0qIr4vLCujkcRSOkziiTz8gDoQChAFggaK10DY60iH38gbXc9GoOrv+SqQ0p3AEsR0WjHQLkV5kE9g==' ; const decodedWithBazinga64 = bazinga64 . Decoder . fromBase64 ( encoded ) . asBytes ; const decodedWithSodium = sodium . from_base64 ( encoded , sodium . base64_variants . ORIGINAL ) ; expect ( decodedWithBazinga64 ) . toEqual ( decodedWithSodium ) ; } ) ; } ) ;