test: align resource availability metadata
This commit was merged in pull request #50.
This commit is contained in:
@@ -128,7 +128,8 @@ describe('local income completeness and exact money (SQLite)', () => {
|
||||
for (let index = 0; index < 2; index++) {
|
||||
const result = await read();
|
||||
assert(result.data);
|
||||
expect(result.meta.availability).toBe('complete');
|
||||
expect(result.meta.availability).toBe('available');
|
||||
expect(result.meta.completeness).toBe('complete');
|
||||
expect(result.data.totalsByCurrency.map((row) => row.total)).toEqual([
|
||||
{ currency: 'RUB', value: '15.000000002' },
|
||||
{ currency: 'USD', value: '6' },
|
||||
@@ -146,10 +147,9 @@ describe('local income completeness and exact money (SQLite)', () => {
|
||||
'previous',
|
||||
'year',
|
||||
]);
|
||||
expect(
|
||||
result.meta.dependencies.find(({ role }) => role === 'previous')
|
||||
?.availability,
|
||||
).toBe('missing');
|
||||
const previous = result.meta.dependencies.find(({ role }) => role === 'previous');
|
||||
expect(previous?.availability).toBe('temporarily-unavailable');
|
||||
expect(previous?.completeness).toBe('incomplete');
|
||||
expect(result.data.calculatedAt).toBe('2025-02-01T00:00:00.000Z');
|
||||
await prisma.$disconnect();
|
||||
}
|
||||
@@ -161,7 +161,9 @@ describe('local income completeness and exact money (SQLite)', () => {
|
||||
where: { accountId: 'b' },
|
||||
});
|
||||
expect((await read()).data).toBeNull();
|
||||
expect((await read()).meta.availability).toBe('partial');
|
||||
const incomplete = await read();
|
||||
expect(incomplete.meta.availability).toBe('temporarily-unavailable');
|
||||
expect(incomplete.meta.completeness).toBe('incomplete');
|
||||
expect((await read('a')).data).not.toBeNull();
|
||||
expect((await read('a', 'from=2025-03-01&to=2025-03-31')).data).toBeNull();
|
||||
await coverage(
|
||||
@@ -241,7 +243,7 @@ describe('local income completeness and exact money (SQLite)', () => {
|
||||
await repo.fail(fence, false);
|
||||
const after = await read();
|
||||
expect(after.data).toEqual(before.data);
|
||||
expect(after.meta.sync.state).toBe('failed');
|
||||
expect(after.meta.lastAttempt.state).toBe('failed');
|
||||
expect(upstream.getOperationsByCursor).not.toHaveBeenCalled();
|
||||
});
|
||||
it('retains current-month observed completeness and does not renew source timestamps', async () => {
|
||||
@@ -261,7 +263,8 @@ describe('local income completeness and exact money (SQLite)', () => {
|
||||
from: `${today.slice(0, 7)}-01`,
|
||||
to: today,
|
||||
});
|
||||
expect(result.meta.availability).toBe('complete');
|
||||
expect(result.meta.availability).toBe('available');
|
||||
expect(result.meta.completeness).toBe('complete');
|
||||
expect(result.meta.coverage?.asOf).toBe(asOf.toISOString());
|
||||
expect(result.data?.calculatedAt).toBe('2025-02-01T00:00:00.000Z');
|
||||
expect(upstream.getOperationsByCursor).not.toHaveBeenCalled();
|
||||
|
||||
Reference in New Issue
Block a user