refactor: test utils (#16588)

This commit is contained in:
Jason Rasmussen 2025-03-04 11:15:41 -05:00 committed by GitHub
parent 1423cfd53c
commit 63c01b78e2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 245 additions and 216 deletions

View file

@ -21,12 +21,12 @@ describe(VersionService.name, () => {
it('record the current version on startup', async () => {
const { context, sut } = await setup();
const itemsBefore = await context.versionHistoryRepository.getAll();
const itemsBefore = await context.versionHistory.getAll();
expect(itemsBefore).toHaveLength(0);
await sut.onBootstrap();
const itemsAfter = await context.versionHistoryRepository.getAll();
const itemsAfter = await context.versionHistory.getAll();
expect(itemsAfter).toHaveLength(1);
expect(itemsAfter[0]).toEqual({
createdAt: expect.any(Date),
@ -38,7 +38,7 @@ describe(VersionService.name, () => {
it('should queue memory creation when upgrading from 1.128.0', async () => {
const { context, jobMock, sut } = await setup();
await context.versionHistoryRepository.create({ version: 'v1.128.0' });
await context.versionHistory.create({ version: 'v1.128.0' });
await sut.onBootstrap();
expect(jobMock.queue).toHaveBeenCalledWith({ name: JobName.MEMORIES_CREATE });
@ -47,7 +47,7 @@ describe(VersionService.name, () => {
it('should not queue memory creation when upgrading from 1.129.0', async () => {
const { context, jobMock, sut } = await setup();
await context.versionHistoryRepository.create({ version: 'v1.129.0' });
await context.versionHistory.create({ version: 'v1.129.0' });
await sut.onBootstrap();
expect(jobMock.queue).not.toHaveBeenCalled();