diff --git a/utils/GunSmith/GunSmith.js b/utils/GunSmith/GunSmith.js index 01dc37e1..bc26fdc0 100644 --- a/utils/GunSmith/GunSmith.js +++ b/utils/GunSmith/GunSmith.js @@ -233,7 +233,6 @@ const isReady = () => isReady().then(res) }, 1000) } else { - logger.info('isReady') res() } }) diff --git a/utils/GunSmith/GunSmith.spec.js b/utils/GunSmith/GunSmith.spec.js index cb9d87c4..5a2bf8a8 100644 --- a/utils/GunSmith/GunSmith.spec.js +++ b/utils/GunSmith/GunSmith.spec.js @@ -426,4 +426,28 @@ describe('gun smith', () => { done() release() }) + + // eslint-disable-next-line jest/expect-expect + it('provides an special once() that restarts gun until a value is fetched', async done => { + expect.assertions(1) + await whenReady() + jest.setTimeout(100000) + + const a = words() + const b = words() + const node = instance.get(a).get(b) + const value = words() + + node.once(data => { + if (data === value) { + expect(data).toEqual(value) + jest.setTimeout(5000) + done() + } + }) + + setTimeout(() => { + node.put(value) + }, 9000) + }) })