Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
test: fix tests, cleanup jest output
- in #12021 type of server response was changed to strings, forget to cover tests
- Element.scrollTo is not implemented in JSDOM, need to mock it to avoid errors in Jest

Signed-off-by: Maksim Sukharev <[email protected]>
  • Loading branch information
Antreesy committed Apr 18, 2024
commit 1ca972d161ac8554f27d4c1a8dc60fcf1ee56af0
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ describe('FilePreview.vue', () => {
id: '123',
name: 'test.jpg',
path: 'path/to/test.jpg',
size: 128,
size: '128',
etag: '1872ade88f3013edeb33decd74a4f947',
permissions: 15,
permissions: '15',
mimetype: 'image/jpeg',
previewAvailable: 'yes',
}
Expand Down Expand Up @@ -262,7 +262,7 @@ describe('FilePreview.vue', () => {
})
})
test('directly renders small GIF files', async () => {
propsData.size = 128
propsData.size = '128'

const wrapper = shallowMount(FilePreview, {
localVue,
Expand All @@ -278,7 +278,7 @@ describe('FilePreview.vue', () => {
})

test('directly renders small GIF files (absolute path)', async () => {
propsData.size = 128
propsData.size = '128'
propsData.path = '/path/to/test %20.gif'

const wrapper = shallowMount(FilePreview, {
Expand All @@ -295,7 +295,7 @@ describe('FilePreview.vue', () => {
})

test('directly renders small GIF files for guests', async () => {
propsData.size = 128
propsData.size = '128'
propsData.link = 'https://localhost/nc-webroot/s/xtokenx'
getUserIdMock.mockClear().mockReturnValue(null)

Expand All @@ -314,7 +314,7 @@ describe('FilePreview.vue', () => {

test('renders static preview for big GIF files', async () => {
// bigger than max from capability
propsData.size = 2048
propsData.size = '2048'

const wrapper = shallowMount(FilePreview, {
localVue,
Expand Down Expand Up @@ -485,7 +485,7 @@ describe('FilePreview.vue', () => {
propsData.mimetype = 'image/gif'
propsData.name = 'test.gif'
propsData.path = 'path/to/test.gif'
propsData.size = 10000000 // bigger than default max
propsData.size = '10000000' // bigger than default max

await testPlayButtonVisible(true)
})
Expand Down
3 changes: 3 additions & 0 deletions src/components/MessagesList/MessagesList.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ describe('MessagesList.vue', () => {
// eslint-disable-next-line import/no-named-as-default-member
store = new Vuex.Store(testStoreConfig)

// scrollTo isn't implemented in JSDOM
Element.prototype.scrollTo = () => {}

// hack to catch date separators
const oldTee = global.t
global.t = jest.fn().mockImplementation(function(pkg, text, data) {
Expand Down