mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2024-11-10 01:02:30 +01:00
increase coverage for tokenUtils
This commit is contained in:
parent
1f939116a4
commit
acae9da06c
1 changed files with 25 additions and 0 deletions
|
@ -44,6 +44,31 @@ describe("tokenUtils test", function() {
|
|||
});
|
||||
});
|
||||
|
||||
after(function () {
|
||||
mock.restore();
|
||||
});
|
||||
});
|
||||
|
||||
describe("tokenUtils failing tests", function() {
|
||||
before(function() {
|
||||
mock = new MockAdapter(axios, { onNoMatch: "throwException" });
|
||||
mock.onPost("https://www.patreon.com/api/oauth2/token").reply(204, patreon.fakeOauth);
|
||||
mock.onGet(/identity/).reply(204, patreon.activeIdentity);
|
||||
});
|
||||
|
||||
it("Should fail if patreon is not correctly stubbed", function (done) {
|
||||
tokenUtils.createAndSaveToken(tokenUtils.TokenType.patreon, "test_code").then((licenseKey) => {
|
||||
assert.strictEqual(licenseKey, null);
|
||||
done();
|
||||
});
|
||||
});
|
||||
it("Should fail if token type is invalid", (done) => {
|
||||
tokenUtils.createAndSaveToken("invalidTokenType" as tokenUtils.TokenType).then((licenseKey) => {
|
||||
assert.strictEqual(licenseKey, null);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
after(function () {
|
||||
mock.restore();
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue