From c99267135662f637c6e69266e497de9a3a75cbf1 Mon Sep 17 00:00:00 2001 From: Daniel Lugo Date: Tue, 21 Sep 2021 16:20:43 -0400 Subject: [PATCH] Change test order, avoids undiagnosed race cond --- utils/GunSmith/GunSmith.spec.js | 46 +++++++++++++++++---------------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/utils/GunSmith/GunSmith.spec.js b/utils/GunSmith/GunSmith.spec.js index 5e8e0c2f..2e8dd37c 100644 --- a/utils/GunSmith/GunSmith.spec.js +++ b/utils/GunSmith/GunSmith.spec.js @@ -228,6 +228,30 @@ describe('gun smith', () => { }) }) + it('provides an special once() 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() + + node.specialOnce(data => { + expect(data).toEqual(value) + + done() + release() + }) + + setTimeout(() => { + node.put(value) + }, 30000) + }) + + // 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 => { expect.assertions(100) await whenReady() @@ -430,26 +454,4 @@ describe('gun smith', () => { done() release() }) - - it('provides an special once() 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() - - node.specialOnce(data => { - expect(data).toEqual(value) - - done() - release() - }) - - setTimeout(() => { - node.put(value) - }, 30000) - }) })