fix(tests): sync test expectations with current implementation
Update dialect tests for UTC timestamp functions and cleaner-handler test for runCleaner's extended parameter signature. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -8,11 +8,23 @@ const withErrorHandlingMock = vi.fn(async (handler: () => Promise<unknown>) => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
const serviceMethods = {
|
const serviceMethods = {
|
||||||
runCleaner: vi.fn(async (_sender: unknown, input: unknown) => ({ success: true, input })),
|
runCleaner: vi.fn(
|
||||||
|
async (
|
||||||
|
_sender: unknown,
|
||||||
|
input: unknown,
|
||||||
|
_batchId: string,
|
||||||
|
_historyDao: unknown,
|
||||||
|
_appVersion: string
|
||||||
|
) => ({ success: true, input })
|
||||||
|
),
|
||||||
exportResults: vi.fn(async (items: unknown[]) => ({ success: true, total: items.length }))
|
exportResults: vi.fn(async (items: unknown[]) => ({ success: true, total: items.length }))
|
||||||
}
|
}
|
||||||
|
|
||||||
vi.mock('electron', () => ({
|
vi.mock('electron', () => ({
|
||||||
|
app: {
|
||||||
|
isPackaged: false,
|
||||||
|
getVersion: () => 'test-version'
|
||||||
|
},
|
||||||
ipcMain: {
|
ipcMain: {
|
||||||
handle: handleMock
|
handle: handleMock
|
||||||
}
|
}
|
||||||
@@ -51,7 +63,14 @@ describe('registerCleanerHandlers', () => {
|
|||||||
|
|
||||||
const result = await runHandler?.(event, input)
|
const result = await runHandler?.(event, input)
|
||||||
|
|
||||||
expect(serviceMethods.runCleaner).toHaveBeenCalledWith(sender, input)
|
expect(serviceMethods.runCleaner).toHaveBeenCalledTimes(1)
|
||||||
|
const actualCall = serviceMethods.runCleaner.mock.calls[0]
|
||||||
|
expect(actualCall[0]).toBe(sender)
|
||||||
|
expect(actualCall[1]).toEqual(input)
|
||||||
|
expect(typeof actualCall[2]).toBe('string') // batchId is UUID
|
||||||
|
expect(actualCall[3]).toBeDefined() // historyDao
|
||||||
|
expect(actualCall[4]).toBe('test-version') // appVersion
|
||||||
|
|
||||||
expect(result).toEqual({
|
expect(result).toEqual({
|
||||||
success: true,
|
success: true,
|
||||||
data: { success: true, input }
|
data: { success: true, input }
|
||||||
|
|||||||
@@ -46,8 +46,8 @@ describe('MySqlDialect', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
describe('currentTimestamp', () => {
|
describe('currentTimestamp', () => {
|
||||||
it('should return NOW()', () => {
|
it('should return UTC_TIMESTAMP()', () => {
|
||||||
expect(dialect.currentTimestamp()).toBe('NOW()')
|
expect(dialect.currentTimestamp()).toBe('UTC_TIMESTAMP()')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -45,8 +45,8 @@ describe('SqlServerDialect', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
describe('currentTimestamp', () => {
|
describe('currentTimestamp', () => {
|
||||||
it('should return GETDATE()', () => {
|
it('should return SYSUTCDATETIME()', () => {
|
||||||
expect(dialect.currentTimestamp()).toBe('GETDATE()')
|
expect(dialect.currentTimestamp()).toBe('SYSUTCDATETIME()')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user