✨feature: First push to git
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
import { mkdtemp, rm } from 'node:fs/promises';
|
||||
import { tmpdir } from 'node:os';
|
||||
import { join } from 'node:path';
|
||||
import { afterEach, beforeEach, describe, expect, it } from 'vitest';
|
||||
import { StateStore } from '../src/state/state.js';
|
||||
|
||||
let dir = '';
|
||||
|
||||
beforeEach(async () => {
|
||||
dir = await mkdtemp(join(tmpdir(), 'nlc-'));
|
||||
});
|
||||
|
||||
afterEach(async () => {
|
||||
await rm(dir, { force: true, recursive: true });
|
||||
});
|
||||
|
||||
describe('state persistence', () => {
|
||||
it('tracks processed messages incrementally', async () => {
|
||||
const store = new StateStore(join(dir, 'state.json'));
|
||||
|
||||
expect(await store.isProcessed('msg-1')).toBe(false);
|
||||
await store.markProcessed('msg-1');
|
||||
expect(await store.isProcessed('msg-1')).toBe(true);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user