File tree Expand file tree Collapse file tree 2 files changed +34
-1
lines changed
Expand file tree Collapse file tree 2 files changed +34
-1
lines changed Original file line number Diff line number Diff line change 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+ } ) ;
Original file line number Diff line number Diff 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 {
You can’t perform that action at this time.
0 commit comments