|
@@ -316,30 +316,26 @@ describe('Sesame should unlock the socket', () => {
|
316
|
316
|
it('should not work without sesame', (done) => {
|
317
|
317
|
const sock = new RPCSocket(21004, "localhost")
|
318
|
318
|
sock.connect<SesameTestIfc>( /* no sesame */).then(async (cli) => {
|
319
|
|
- cli.test.checkCandy().then(d => {
|
320
|
|
- done(d)
|
321
|
|
- }).catch(e => {
|
322
|
|
- //console.log("EXPECTED CLIENT EXCEPTION", String(e));
|
|
319
|
+ if(!cli.test)
|
323
|
320
|
done()
|
324
|
|
- }).finally(() => {
|
325
|
|
- cli.destroy()
|
326
|
|
- sock.destroy()
|
327
|
|
- })
|
|
321
|
+ else{
|
|
322
|
+ done(new Error("Function supposed to be removed without sesame"))
|
|
323
|
+ }
|
|
324
|
+ cli.destroy()
|
|
325
|
+ sock.destroy()
|
328
|
326
|
})
|
329
|
327
|
})
|
330
|
328
|
|
331
|
329
|
it('should fail with wrong sesame', (done) => {
|
332
|
330
|
const sock = new RPCSocket(21004, "localhost")
|
333
|
331
|
sock.connect<SesameTestIfc>('abasd').then(async (cli) => {
|
334
|
|
- cli.test.checkCandy().then(d => {
|
335
|
|
- done("should not be able to get candy")
|
336
|
|
- }).catch(e => {
|
337
|
|
- //console.log("EXPECTED CLIENT EXCEPTION", String(e));
|
|
332
|
+ if(!cli.test)
|
338
|
333
|
done()
|
339
|
|
- }).finally(() => {
|
340
|
|
- sock.destroy()
|
341
|
|
- cli.destroy()
|
342
|
|
- })
|
|
334
|
+ else{
|
|
335
|
+ done(new Error("Function supposed to be removed without sesame"))
|
|
336
|
+ }
|
|
337
|
+ cli.destroy()
|
|
338
|
+ sock.destroy()
|
343
|
339
|
})
|
344
|
340
|
})
|
345
|
341
|
|
|
@@ -355,27 +351,6 @@ describe('Sesame should unlock the socket', () => {
|
355
|
351
|
client.test.checkCandy()
|
356
|
352
|
})
|
357
|
353
|
})
|
358
|
|
-
|
359
|
|
- it('callback should not work without sesame', (done) => {
|
360
|
|
- const sock = new RPCSocket(21004, "localhost")
|
361
|
|
- sock.connect<SesameTestIfc>( /* no sesame */).then(async (cli) => {
|
362
|
|
- cli.test.subscribe((c) => {
|
363
|
|
- console.log("CALLBACK TRIGGERED UNEXPECTED");
|
364
|
|
-
|
365
|
|
- if(c === candy)
|
366
|
|
- done("super not")
|
367
|
|
- }).then(async d => {
|
368
|
|
- await client.test.checkCandy()
|
369
|
|
- if(d == null){
|
370
|
|
- done()
|
371
|
|
-
|
372
|
|
- }else
|
373
|
|
- done('unexpected valid response '+(d) )
|
374
|
|
- }).finally(() => {
|
375
|
|
- sock.destroy()
|
376
|
|
- })
|
377
|
|
- })
|
378
|
|
- })
|
379
|
354
|
})
|
380
|
355
|
|
381
|
356
|
|