refactor: retire legacy tbank-sync status and sync=observe (WealthLedger/backend#196)
This commit is contained in:
@@ -199,7 +199,7 @@ describe('atomic shared candle reconciliation (SQLite)', () => {
|
||||
).toBe(false);
|
||||
expect((await repository.read('uid', range)).coverage).toEqual([]);
|
||||
});
|
||||
it('coalesces twenty reads, makes observe passive and reuses closed windows after reopen', async () => {
|
||||
it('coalesces twenty reads and reuses closed windows after reopen', async () => {
|
||||
const service = createService();
|
||||
const input = {
|
||||
uid: 'uid',
|
||||
@@ -216,7 +216,6 @@ describe('atomic shared candle reconciliation (SQLite)', () => {
|
||||
);
|
||||
expect(cold.every((row) => row.data === null)).toBe(true);
|
||||
expect(await prisma.tbankSyncWork.count()).toBe(1);
|
||||
await service.read('owner', input, true);
|
||||
release([]);
|
||||
await settled();
|
||||
const count = upstream.getCandles.mock.calls.length;
|
||||
@@ -239,7 +238,7 @@ describe('atomic shared candle reconciliation (SQLite)', () => {
|
||||
where: { isComplete: false },
|
||||
data: { fetchedAt: new Date(0) },
|
||||
});
|
||||
const stale = await reopened.read('owner', input, true);
|
||||
const stale = await reopened.read('owner', input);
|
||||
expect(stale.meta.availability).toBe('available');
|
||||
expect(stale.meta.completeness).toBe('complete');
|
||||
expect(stale.meta.freshness).toBe('stale');
|
||||
@@ -251,7 +250,7 @@ describe('atomic shared candle reconciliation (SQLite)', () => {
|
||||
await settled();
|
||||
expect(upstream.getCandles).toHaveBeenCalledTimes(count + 1);
|
||||
});
|
||||
it('recovers abandoned work only on a new ordinary request', async () => {
|
||||
it('recovers abandoned work on an ordinary request', async () => {
|
||||
const input = {
|
||||
uid: 'uid',
|
||||
instrumentType: 'share' as const,
|
||||
@@ -265,12 +264,6 @@ describe('atomic shared candle reconciliation (SQLite)', () => {
|
||||
new Set(),
|
||||
);
|
||||
const reopened = createService();
|
||||
await reopened.read('owner', input, true);
|
||||
expect(upstream.getCandles).not.toHaveBeenCalled();
|
||||
expect(
|
||||
(await repository.work('owner', 'revision', 'candles:uid:month'))
|
||||
?.attemptId,
|
||||
).toBe(abandoned?.work.attemptId);
|
||||
await reopened.read('owner', input);
|
||||
await settled();
|
||||
expect(upstream.getCandles).toHaveBeenCalledTimes(1);
|
||||
@@ -302,7 +295,7 @@ describe('atomic shared candle reconciliation (SQLite)', () => {
|
||||
await settled();
|
||||
expect(await prisma.tbankCandleCoverage.findMany()).toEqual(before);
|
||||
expect(await prisma.tbankCandle.count()).toBe(0);
|
||||
const read = await service.read('owner', input, true);
|
||||
const read = await service.read('owner', input);
|
||||
expect(read.meta.lastAttempt.state).toBe('failed');
|
||||
expect(read.data?.candles).toEqual([]);
|
||||
});
|
||||
@@ -474,7 +467,7 @@ describe('atomic shared candle reconciliation (SQLite)', () => {
|
||||
};
|
||||
await service.read('owner', input);
|
||||
await settled();
|
||||
const result = await service.read('owner', input, true);
|
||||
const result = await service.read('owner', input);
|
||||
expect(result.data?.currency).toBeNull();
|
||||
expect(result.data?.candles).toEqual([
|
||||
{ time: now.toISOString(), close: '99.123456789', isComplete: false },
|
||||
|
||||
Reference in New Issue
Block a user