Skip to content

Commit b5ef99d

Browse files
committed
fix(tests): add missing model tests
1 parent 76c3324 commit b5ef99d

File tree

2 files changed

+34
-1
lines changed

2 files changed

+34
-1
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
const Model = require('../../../lib/model');
2+
const {expect} = require('chai');
3+
4+
describe('ModelWrapper', () => {
5+
const expectThrows = async (fn) => {
6+
try {
7+
await fn();
8+
expect.fail();
9+
} catch (e) {
10+
expect(e.message).to.include('not implemented');
11+
}
12+
};
13+
it('throws on all functions when used via constructor', async () => {
14+
const m = new Model();
15+
await expectThrows(() => m.generateAccessToken());
16+
await expectThrows(() => m.generateAuthorizationCode());
17+
await expectThrows(() => m.generateRefreshToken());
18+
await expectThrows(() => m.getAccessToken());
19+
await expectThrows(() => m.getAuthorizationCode());
20+
await expectThrows(() => m.getClient());
21+
await expectThrows(() => m.getRefreshToken());
22+
await expectThrows(() => m.getUser());
23+
await expectThrows(() => m.getUserFromClient());
24+
await expectThrows(() => m.revokeAuthorizationCode());
25+
await expectThrows(() => m.revokeToken());
26+
await expectThrows(() => m.saveAuthorizationCode());
27+
await expectThrows(() => m.saveToken());
28+
await expectThrows(() => m.verifyScope());
29+
await expectThrows(() => m.validateRedirectUri());
30+
await expectThrows(() => m.validateScope());
31+
32+
});
33+
});

test/unit/models/token-model_test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const should = require('chai').should();
55
* Test `Server`.
66
*/
77

8-
describe('Model', function() {
8+
describe('TokenModel', function() {
99
describe('constructor()', function() {
1010
it('throws, if data is empty', function () {
1111
try {

0 commit comments

Comments
 (0)