From eaf798521871369f8f94b6354e72d74c3460c92f Mon Sep 17 00:00:00 2001 From: Julian Gruber Date: Mon, 11 Nov 2024 16:10:51 +0100 Subject: [PATCH 1/3] Revert "FIXME disable failing assertions" This reverts commit 27772b33e53140ced1688af899462e6e5455c616. --- api/test/test.js | 58 ++++++++++++++++++++++++------------------------ 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/api/test/test.js b/api/test/test.js index e2bea001..3d7b7d2c 100644 --- a/api/test/test.js +++ b/api/test/test.js @@ -688,16 +688,16 @@ describe('Routes', () => { const res = await fetch(`${spark}/miner/f0230/deals/eligible/summary`) await assertResponseStatus(res, 200) assert.strictEqual(res.headers.get('cache-control'), 'max-age=21600') - // const body = await res.json() - // assert.deepStrictEqual(body, { - // minerId: 'f0230', - // dealCount: 5, - // clients: [ - // { clientId: 'f0800', dealCount: 3 }, - // { clientId: 'f0810', dealCount: 1 }, - // { clientId: 'f0820', dealCount: 1 } - // ] - // }) + const body = await res.json() + assert.deepStrictEqual(body, { + minerId: 'f0230', + dealCount: 5, + clients: [ + { clientId: 'f0800', dealCount: 3 }, + { clientId: 'f0810', dealCount: 1 }, + { clientId: 'f0820', dealCount: 1 } + ] + }) }) it('returns an empty array for miners with no deals in our DB', async () => { @@ -718,16 +718,16 @@ describe('Routes', () => { const res = await fetch(`${spark}/client/f0800/deals/eligible/summary`) await assertResponseStatus(res, 200) assert.strictEqual(res.headers.get('cache-control'), 'max-age=21600') - // const body = await res.json() - // assert.deepStrictEqual(body, { - // clientId: 'f0800', - // dealCount: 5, - // providers: [ - // { minerId: 'f0230', dealCount: 3 }, - // { minerId: 'f0210', dealCount: 1 }, - // { minerId: 'f0220', dealCount: 1 } - // ] - // }) + const body = await res.json() + assert.deepStrictEqual(body, { + clientId: 'f0800', + dealCount: 5, + providers: [ + { minerId: 'f0230', dealCount: 3 }, + { minerId: 'f0210', dealCount: 1 }, + { minerId: 'f0220', dealCount: 1 } + ] + }) }) it('returns an empty array for miners with no deals in our DB', async () => { @@ -748,15 +748,15 @@ describe('Routes', () => { const res = await fetch(`${spark}/allocator/f0500/deals/eligible/summary`) await assertResponseStatus(res, 200) assert.strictEqual(res.headers.get('cache-control'), 'max-age=21600') - // const body = await res.json() - // assert.deepStrictEqual(body, { - // allocatorId: 'f0500', - // dealCount: 7, - // clients: [ - // { clientId: 'f0800', dealCount: 5 }, - // { clientId: 'f0810', dealCount: 2 } - // ] - // }) + const body = await res.json() + assert.deepStrictEqual(body, { + allocatorId: 'f0500', + dealCount: 7, + clients: [ + { clientId: 'f0800', dealCount: 5 }, + { clientId: 'f0810', dealCount: 2 } + ] + }) }) it('returns an empty array for miners with no deals in our DB', async () => { From 1c511498989ec55d926b7425a3c161bc02439e68 Mon Sep 17 00:00:00 2001 From: Julian Gruber Date: Mon, 11 Nov 2024 16:15:53 +0100 Subject: [PATCH 2/3] running test suite twice to demonstrate side effect --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0a9b4c78..3ae5c959 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -32,6 +32,7 @@ jobs: node-version: 20 - run: npm ci - run: npm test + - run: npm test build-publish: runs-on: ubuntu-latest From 2a4a427fb534ac5852e38272f53256a99f362b6d Mon Sep 17 00:00:00 2001 From: Julian Gruber Date: Mon, 11 Nov 2024 16:16:04 +0100 Subject: [PATCH 3/3] make it pass on the first run --- api/test/test.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/api/test/test.js b/api/test/test.js index 3d7b7d2c..bb544abb 100644 --- a/api/test/test.js +++ b/api/test/test.js @@ -691,9 +691,9 @@ describe('Routes', () => { const body = await res.json() assert.deepStrictEqual(body, { minerId: 'f0230', - dealCount: 5, + dealCount: 4, clients: [ - { clientId: 'f0800', dealCount: 3 }, + { clientId: 'f0800', dealCount: 2 }, { clientId: 'f0810', dealCount: 1 }, { clientId: 'f0820', dealCount: 1 } ] @@ -721,9 +721,9 @@ describe('Routes', () => { const body = await res.json() assert.deepStrictEqual(body, { clientId: 'f0800', - dealCount: 5, + dealCount: 4, providers: [ - { minerId: 'f0230', dealCount: 3 }, + { minerId: 'f0230', dealCount: 2 }, { minerId: 'f0210', dealCount: 1 }, { minerId: 'f0220', dealCount: 1 } ] @@ -751,9 +751,9 @@ describe('Routes', () => { const body = await res.json() assert.deepStrictEqual(body, { allocatorId: 'f0500', - dealCount: 7, + dealCount: 6, clients: [ - { clientId: 'f0800', dealCount: 5 }, + { clientId: 'f0800', dealCount: 4 }, { clientId: 'f0810', dealCount: 2 } ] })