Skip to content

Commit

Permalink
fix(test): adjust AttachmentResolver test for vitest
Browse files Browse the repository at this point in the history
* Port changed to 3000.
* Stub axios request as `vitest` will catch failing requests
  even if the test itself passes.

Signed-off-by: Max <max@nextcloud.com>
  • Loading branch information
max-nextcloud committed Oct 14, 2024
1 parent 017ca9f commit 8a7e10b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/tests/services/AttachmentResolver.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ describe('Image resolver', () => {
const currentDirectory = '/parentDir'

it('is a class with one constructor argument', () => {
const resolver = new AttachmentResolver({ fileId })
const resolver = initAttachmentResolver({ fileId })
expect(resolver).toBeInstanceOf(AttachmentResolver)
})

Expand Down Expand Up @@ -92,7 +92,8 @@ describe('Image resolver', () => {
const resolver = new AttachmentResolver({ fileId, user, currentDirectory })
const attachment = await resolver.resolve(src)
expect(attachment.isImage).toBe(true)
expect(attachment.previewUrl).toBe('http://localhost/remote.php/dav/files/user-uid/parentDir/path/to/some%20image.png')
expect(attachment.previewUrl)
.toBe('http://localhost:3000/remote.php/dav/files/user-uid/parentDir/path/to/some%20image.png')
})

})

0 comments on commit 8a7e10b

Please sign in to comment.