You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
743 B
23 lines
743 B
import { test } from 'node:test'; |
|
import assert from 'node:assert/strict'; |
|
import { hasAnyAttemptForTest } from './testChainService.js'; |
|
|
|
test('hasAnyAttemptForTest: false, если в базе пусто', async () => { |
|
const pool = { |
|
async query() { |
|
return { rows: [{ has_any: false }] }; |
|
}, |
|
}; |
|
const result = await hasAnyAttemptForTest(pool, '00000000-0000-0000-0000-000000000001'); |
|
assert.equal(result, false); |
|
}); |
|
|
|
test('hasAnyAttemptForTest: true, если есть попытка', async () => { |
|
const pool = { |
|
async query() { |
|
return { rows: [{ has_any: true }] }; |
|
}, |
|
}; |
|
const result = await hasAnyAttemptForTest(pool, '00000000-0000-0000-0000-000000000001'); |
|
assert.equal(result, true); |
|
});
|
|
|