From a21f949a795f603dc639a1a6bcf9d846ac93ac29 Mon Sep 17 00:00:00 2001 From: Daniel Lugo Date: Wed, 22 Sep 2021 10:38:45 -0400 Subject: [PATCH] Test for specialThen() --- utils/GunSmith/GunSmith.spec.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/utils/GunSmith/GunSmith.spec.js b/utils/GunSmith/GunSmith.spec.js index 2e8dd37c..47a7fb4d 100644 --- a/utils/GunSmith/GunSmith.spec.js +++ b/utils/GunSmith/GunSmith.spec.js @@ -250,6 +250,27 @@ describe('gun smith', () => { }, 30000) }) + it('provides an special then() that restarts gun until a value is fetched', async done => { + expect.assertions(1) + jest.setTimeout(100000) + await whenReady() + + const a = words() + const b = words() + const node = instance.get(a).get(b) + const value = words() + + setTimeout(() => { + node.put(value) + }, 30000) + + const res = await node.specialThen() + + expect(res).toBe(value) + done() + release() + }) + // TODO: find out why this test fucks up the previous one if it runs before // that one it('maps over a primitive set', async done => {