Mike Gerwitz

Activist for User Freedom

aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMike Gerwitz <mike.gerwitz@rtspecialty.com>2019-10-16 15:21:26 -0400
committerMike Gerwitz <mike.gerwitz@rtspecialty.com>2019-10-18 09:55:11 -0400
commit16409a014ff6dceffae37f2c23334a54026b1247 (patch)
tree55befe739dca1683d90fe16a75807102b4cd815d /test
parent544fe1a1fe8c154adb8539905e17b0701baee7d7 (diff)
downloadliza-16409a014ff6dceffae37f2c23334a54026b1247.tar.gz
liza-16409a014ff6dceffae37f2c23334a54026b1247.tar.bz2
liza-16409a014ff6dceffae37f2c23334a54026b1247.zip
TokenedDataApi: Accept or kill token
Rather than leaving a token in a DONE state, we should either transition to ACCEPTED or DEAD depending on whether the token was superceded. * src/server/dapi/TokenedDataApi.ts (_replyUnlessStale): Accept token when not superceded, otherwise kill. [store]: New param. (request): Use it. * test/server/dapi/TokenedDataApiTest.ts: Update accordingly.
Diffstat (limited to 'test')
-rw-r--r--test/server/dapi/TokenedDataApiTest.ts15
1 files changed, 12 insertions, 3 deletions
diff --git a/test/server/dapi/TokenedDataApiTest.ts b/test/server/dapi/TokenedDataApiTest.ts
index 558f699..27375fa 100644
--- a/test/server/dapi/TokenedDataApiTest.ts
+++ b/test/server/dapi/TokenedDataApiTest.ts
@@ -76,6 +76,7 @@ describe( 'TokenedDataApi', () =>
createStubToken( last_created );
let tok_completed = false;
+ let tok_ackd = false;
const mock_tstore = new class implements TokenStore
{
@@ -109,12 +110,20 @@ describe( 'TokenedDataApi', () =>
acceptToken()
{
- return Promise.reject( Error( "not used" ) );
+ expect( tok_completed ).to.be.true;
+ expect( last_created ).to.be.true;
+
+ tok_ackd = true;
+ return Promise.resolve( Object.create( stub_tok ) );
}
killToken()
{
- return Promise.reject( Error( "not used" ) );
+ expect( tok_completed ).to.be.true;
+ expect( last_created ).to.be.false;
+
+ tok_ackd = true;
+ return Promise.resolve( Object.create( stub_tok ) );
}
}();
@@ -143,7 +152,7 @@ describe( 'TokenedDataApi', () =>
const callback: NodeCallback<DataApiResult> = ( e, data ) =>
{
- expect( tok_completed ).to.be.true;
+ expect( tok_ackd ).to.be.true;
expected_err( e );