diff --git a/src/server/token/MongoTokenDao.ts b/src/server/token/MongoTokenDao.ts index 66c3c96..5e0debc 100644 --- a/src/server/token/MongoTokenDao.ts +++ b/src/server/token/MongoTokenDao.ts @@ -91,6 +91,8 @@ export class MongoTokenDao implements TokenDao * @param token token value * @param data token data, if any * @param status arbitrary token type + * + * @return token data */ updateToken( doc_id: DocumentId, @@ -98,7 +100,7 @@ export class MongoTokenDao implements TokenDao token_id: TokenId, type: TokenType, data: string | null, - ): Promise + ): Promise { const root = this._genRoot( ns ) + '.'; @@ -136,7 +138,10 @@ export class MongoTokenDao implements TokenDao return; } - resolve(); + resolve( { + id: token_id, + status: token_entry, + } ); } ); } ); diff --git a/src/server/token/TokenDao.ts b/src/server/token/TokenDao.ts index b942b2c..ebe02b0 100644 --- a/src/server/token/TokenDao.ts +++ b/src/server/token/TokenDao.ts @@ -40,7 +40,7 @@ export interface TokenDao token_id: TokenId, type: TokenType, data: string | null, - ): Promise; + ): Promise; getToken( diff --git a/test/server/token/MongoTokenDaoTest.ts b/test/server/token/MongoTokenDaoTest.ts index 8fe0dff..5af032c 100644 --- a/test/server/token/MongoTokenDaoTest.ts +++ b/test/server/token/MongoTokenDaoTest.ts @@ -88,8 +88,17 @@ describe( 'server.token.TokenDao', () => findOne() {}, }; - return new Sut( coll, field, () => timestamp ) - .updateToken( did, ns, tok_id, tok_type, data ); + return expect( + new Sut( coll, field, () => timestamp ) + .updateToken( did, ns, tok_id, tok_type, data ) + ).to.eventually.deep.equal( { + id: tok_id, + status: { + type: tok_type, + timestamp: timestamp, + data: data, + }, + } ); } );