diff options
author | Mike Gerwitz <mike.gerwitz@rtspecialty.com> | 2019-09-10 12:18:51 -0400 |
---|---|---|
committer | Mike Gerwitz <mike.gerwitz@rtspecialty.com> | 2019-10-17 11:47:14 -0400 |
commit | 37f1b86ac148154448ae75a9930365f563c5688c (patch) | |
tree | ae25542bb405463421afa68c9d8d09b0e00d7263 /test | |
parent | 54b3f0db726cef32838653a396d8aff02f835d8e (diff) | |
download | liza-37f1b86ac148154448ae75a9930365f563c5688c.tar.gz liza-37f1b86ac148154448ae75a9930365f563c5688c.tar.bz2 liza-37f1b86ac148154448ae75a9930365f563c5688c.zip |
TokenDao: "quote"=>"document" with nominal type
* src/document/Document.ts: New file.
* src/server/token/TokenDao.ts: quote=>document and use DocumentId.
* test/server/token/TokenDaoTest.ts: Likewise.
Diffstat (limited to 'test')
-rw-r--r-- | test/server/token/TokenDaoTest.ts | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/test/server/token/TokenDaoTest.ts b/test/server/token/TokenDaoTest.ts index ad06159..c992632 100644 --- a/test/server/token/TokenDaoTest.ts +++ b/test/server/token/TokenDaoTest.ts @@ -34,6 +34,8 @@ import { TokenNamespace, } from "../../../src/server/token/Token"; +import { DocumentId } from "../../../src/document/Document"; + import { expect, use as chai_use } from 'chai'; chai_use( require( 'chai-as-promised' ) ); @@ -46,7 +48,7 @@ describe( 'server.token.TokenDao', () => it( 'updates token with given data', () => { const field = 'foo_field'; - const qid = 12345; + const did = <DocumentId>12345; const ns = <TokenNamespace>'namespace'; const tok_id = <TokenId>'tok123'; const tok_type = 'DONE'; @@ -64,7 +66,7 @@ describe( 'server.token.TokenDao', () => data: data, }; - expect( selector.id ).to.equal( qid ); + expect( selector.id ).to.equal( did ); expect( given_data ).to.deep.equal( { $set: { @@ -87,7 +89,7 @@ describe( 'server.token.TokenDao', () => }; return new Sut( coll, field, () => timestamp ) - .updateToken( qid, ns, tok_id, tok_type, data ); + .updateToken( did, ns, tok_id, tok_type, data ); } ); @@ -106,7 +108,11 @@ describe( 'server.token.TokenDao', () => return expect( new Sut( coll, 'foo', () => <UnixTimestamp>0 ).updateToken( - 0, <TokenNamespace>'ns', <TokenId>'id', 'DONE', null + <DocumentId>0, + <TokenNamespace>'ns', + <TokenId>'id', + 'DONE', + null ) ).to.eventually.be.rejectedWith( expected_error ); } ); @@ -116,7 +122,7 @@ describe( 'server.token.TokenDao', () => describe( '#getToken', () => { const field = 'get_field'; - const qid = 12345; + const did = <DocumentId>12345; const ns = <TokenNamespace>'get_ns'; const expected_status: TokenStatus = { @@ -212,7 +218,7 @@ describe( 'server.token.TokenDao', () => return expect( new Sut( coll, field, () => <UnixTimestamp>0 ) - .getToken( qid, ns, tok_id ) + .getToken( did, ns, tok_id ) ).to.eventually.deep.equal( expected ); } ) ); @@ -233,7 +239,7 @@ describe( 'server.token.TokenDao', () => return expect( new Sut( coll, 'foo', () => <UnixTimestamp>0 ) - .getToken( 0, <TokenNamespace>'ns', <TokenId>'id' ) + .getToken( <DocumentId>0, <TokenNamespace>'ns', <TokenId>'id' ) ).to.eventually.be.rejectedWith( expected_error ); } ); } ); |