Skip to content

Fix undeterministic tests #452

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ jobs:
node-version: 20
- run: npm ci
- run: npm test
- run: npm test

build-publish:
runs-on: ubuntu-latest
Expand Down
58 changes: 29 additions & 29 deletions api/test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: 4,
clients: [
{ clientId: 'f0800', dealCount: 2 },
{ clientId: 'f0810', dealCount: 1 },
{ clientId: 'f0820', dealCount: 1 }
]
})
})

it('returns an empty array for miners with no deals in our DB', async () => {
Expand All @@ -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: 4,
providers: [
{ minerId: 'f0230', dealCount: 2 },
{ minerId: 'f0210', dealCount: 1 },
{ minerId: 'f0220', dealCount: 1 }
]
})
})

it('returns an empty array for miners with no deals in our DB', async () => {
Expand All @@ -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: 6,
clients: [
{ clientId: 'f0800', dealCount: 4 },
{ clientId: 'f0810', dealCount: 2 }
]
})
})

it('returns an empty array for miners with no deals in our DB', async () => {
Expand Down
Loading