wechaty-puppet-service
Version:
Puppet Service for Wechaty
18 lines • 840 B
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
const tstest_1 = require("tstest");
const call_cred_js_1 = require("./call-cred.js");
(0, tstest_1.test)('metaGeneratorToken()', async (t) => {
const TOKEN = 'UUIDv4';
const EXPECTED_AUTHORIZATION = `Wechaty ${TOKEN}`;
const sandbox = tstest_1.sinon.createSandbox();
const spy = sandbox.spy();
const metaGenerator = (0, call_cred_js_1.metaGeneratorToken)(TOKEN);
metaGenerator({}, spy);
t.equal(spy.args[0][0], null, 'should no error');
const metadata = spy.args[0][1];
const authorization = metadata.get('Authorization')[0];
t.equal(authorization, EXPECTED_AUTHORIZATION, 'should generate authorization in metadata');
});
//# sourceMappingURL=call-cred.spec.js.map
;