Mike Gerwitz

Activist for User Freedom

aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMike Gerwitz <mike.gerwitz@rtspecialty.com>2019-09-25 09:34:44 -0400
committerMike Gerwitz <mike.gerwitz@rtspecialty.com>2019-10-18 09:55:10 -0400
commit0a9a5fe56eb1a77994221b80f85f4d0fa1adc8f1 (patch)
treeb2dd51c4dad8a23a4a0e9c36929cf1ceada563cc /test
parent929acf0e90ca7b5e5cc2869d0d8878b1086a7ec3 (diff)
downloadliza-0a9a5fe56eb1a77994221b80f85f4d0fa1adc8f1.tar.gz
liza-0a9a5fe56eb1a77994221b80f85f4d0fa1adc8f1.tar.bz2
liza-0a9a5fe56eb1a77994221b80f85f4d0fa1adc8f1.zip
TokenStore: Provide document id via constructor
The primary use case for this is currently the DataAPI, and the quote id is only available at the highest level of the server, before dapis are processed. In any case, the TokenStore was already described in terms of a combination of document id; namespace; and root field; so it makes sense for doc id to be part of the constructor. If a more generic TokenStore is needed in the future, we could go back to the previous API and wrap it in another class, like a partially applied function (e.g. `DocumentTokenStore`). * src/server/token/TokenStore.ts: Move doc_id out of arguments and into the constructor. * test/server/token/TokenStoreTest.ts: Update accordingly.
Diffstat (limited to 'test')
-rw-r--r--test/server/token/TokenStoreTest.ts16
1 files changed, 8 insertions, 8 deletions
diff --git a/test/server/token/TokenStoreTest.ts b/test/server/token/TokenStoreTest.ts
index 01a263c..76e97af 100644
--- a/test/server/token/TokenStoreTest.ts
+++ b/test/server/token/TokenStoreTest.ts
@@ -142,8 +142,8 @@ describe( 'TokenStore', () =>
}();
return expect(
- new Sut( dao, ns, voidIdgen )
- .lookupToken( doc_id, token_id )
+ new Sut( dao, doc_id, ns, voidIdgen )
+ .lookupToken( token_id )
)
.to.eventually.deep.equal( expected );
} ) );
@@ -171,8 +171,8 @@ describe( 'TokenStore', () =>
}();
return expect(
- new Sut( dao, ns, voidIdgen )
- .lookupToken( doc_id, token_id )
+ new Sut( dao, doc_id, ns, voidIdgen )
+ .lookupToken( token_id )
).to.eventually.be.rejectedWith( expected_e );
} );
} );
@@ -270,8 +270,8 @@ describe( 'TokenStore', () =>
}();
return expect(
- new Sut( dao, ns, () => token_id )
- .createToken( doc_id )
+ new Sut( dao, doc_id, ns, () => token_id )
+ .createToken()
).to.eventually.deep.equal( expected );
} ) );
} );
@@ -386,8 +386,8 @@ describe( 'TokenStore', () =>
// dispatch, so it's not testing the state transition
// restrictions that are enforced by the compiler
return expect(
- new Sut( dao, ns, voidIdgen )[ method ](
- doc_id, <any>token, data
+ new Sut( dao, doc_id, ns, voidIdgen )[ method ](
+ <any>token, data
)
).to.eventually.deep.equal( expected );
} );