forked from sashin/sashinexists
run npm install to generate a package lock
This commit is contained in:
15
node_modules/decode-base64/test/fixtures.js
generated
vendored
Normal file
15
node_modules/decode-base64/test/fixtures.js
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
|
||||
/* MAIN */
|
||||
|
||||
const Fixtures = [
|
||||
'',
|
||||
'\0',
|
||||
'\ufeff',
|
||||
'👪',
|
||||
'Hello, World!',
|
||||
new Array ( 55296 ).fill ( 0 ).map ( ( _, index ) => String.fromCharCode ( index ) ).join ( '' )
|
||||
];
|
||||
|
||||
/* EXPORT */
|
||||
|
||||
export default Fixtures;
|
||||
43
node_modules/decode-base64/test/index.js
generated
vendored
Normal file
43
node_modules/decode-base64/test/index.js
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
|
||||
/* IMPORT */
|
||||
|
||||
import {describe} from 'fava';
|
||||
import {Buffer} from 'node:buffer';
|
||||
import U8 from 'uint8-encoding';
|
||||
import decodeBrowser from '../dist/browser.js';
|
||||
import decodeNode from '../dist/node.js';
|
||||
import Fixtures from './fixtures.js';
|
||||
|
||||
/* MAIN */
|
||||
|
||||
describe ( 'decodeBase64', () => {
|
||||
|
||||
for ( const [decode, name] of [[decodeBrowser, 'browser'], [decodeNode, 'node']] ) {
|
||||
|
||||
describe ( name, it => {
|
||||
|
||||
it ( 'returns an actual Uint8Array', t => {
|
||||
|
||||
t.is ( decode ( 'Zm9v' ).constructor, Uint8Array );
|
||||
|
||||
});
|
||||
|
||||
it ( 'works with strings', t => {
|
||||
|
||||
for ( const fixture of Fixtures ) {
|
||||
|
||||
const encoded = U8.encode ( fixture );
|
||||
const base64 = Buffer.from ( fixture ).toString ( 'base64' );
|
||||
const decoded = decode ( base64 );
|
||||
|
||||
t.deepEqual ( decoded, encoded );
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
Reference in New Issue
Block a user