mirror of
https://github.com/stablyai/orca.git
synced 2026-09-22 08:02:28 +00:00
test: make clipboard temp path expectation platform-aware (#3781)
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
|
||||
import { join } from 'node:path'
|
||||
|
||||
const {
|
||||
removeHandlerMock,
|
||||
@@ -131,6 +132,10 @@ describe('registerClipboardHandlers', () => {
|
||||
|
||||
it('saves clipboard images to a local temp file when no connection is provided', async () => {
|
||||
const png = Buffer.from([0, 1, 2, 3])
|
||||
const expectedPath = join(
|
||||
'/tmp',
|
||||
'orca-paste-1760000000000-00000000-0000-4000-8000-000000000000.png'
|
||||
)
|
||||
clipboardReadImageMock.mockReturnValue({
|
||||
isEmpty: () => false,
|
||||
toPNG: () => png
|
||||
@@ -140,12 +145,9 @@ describe('registerClipboardHandlers', () => {
|
||||
|
||||
const handlers = getRegisteredHandlers()
|
||||
await expect(handlers.get('clipboard:saveImageAsTempFile')?.({}, undefined)).resolves.toBe(
|
||||
'/tmp/orca-paste-1760000000000-00000000-0000-4000-8000-000000000000.png'
|
||||
)
|
||||
expect(fsWriteFileMock).toHaveBeenCalledWith(
|
||||
'/tmp/orca-paste-1760000000000-00000000-0000-4000-8000-000000000000.png',
|
||||
png
|
||||
expectedPath
|
||||
)
|
||||
expect(fsWriteFileMock).toHaveBeenCalledWith(expectedPath, png)
|
||||
expect(getSshFilesystemProviderMock).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user