scratch-auth/test/integration/unpack.js
Andrew Sliwinski 3534c204d0 Initial commit
2016-11-03 17:10:04 -04:00

25 lines
562 B
JavaScript

const test = require('tap').test;
const Auth = require('../../index');
const object = {foo: 'bar'};
const encoded = 'eyJmb28iOiJiYXIifQ==';
test('spec', function (t) {
const a = new Auth();
t.type(Auth, 'function');
t.type(a, 'object');
t.type(a.unpack, 'function');
t.end();
});
test('uncompressed', function (t) {
const a = new Auth();
t.strictDeepEqual(a.unpack(encoded), object);
t.end();
});
test('invalid', function (t) {
const a = new Auth();
t.strictDeepEqual(a.unpack(undefined), undefined);
t.end();
});