-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'oeb-widgets-dev' of https://github.com/inab/openEBench-…
…nuxt into oeb-widgets-dev
- Loading branch information
Showing
3 changed files
with
61 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import { mount } from '@vue/test-utils'; | ||
import Vuetify from 'vuetify'; | ||
import Vue from 'vue'; | ||
import ApiError from '@/components/Molecules/ApiError.vue'; | ||
|
||
Vue.use(Vuetify); | ||
|
||
describe('ApiError.vue', () => { | ||
let vuetify; | ||
|
||
beforeEach(() => { | ||
vuetify = new Vuetify(); | ||
}); | ||
|
||
it('should render the illustration correctly', () => { | ||
const wrapper = mount(ApiError, { | ||
vuetify, | ||
stubs: { | ||
'v-img': { | ||
template: '<img />', | ||
}, | ||
}, | ||
}); | ||
|
||
const img = wrapper.find('img'); | ||
expect(img.exists()).toBe(true); | ||
expect(img.attributes('src')).toBe( | ||
require('~/static/images/illustrations/error.png') | ||
); | ||
}); | ||
|
||
it('should display the error message', () => { | ||
const wrapper = mount(ApiError, { | ||
vuetify, | ||
}); | ||
|
||
const errorMsg = wrapper.find('.api-error-msg'); | ||
expect(errorMsg.exists()).toBe(true); | ||
expect(errorMsg.text()).toBe( | ||
'Looks like the server is taking to long to respond,' + | ||
'please try again later.' | ||
); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { shallowMount } from '@vue/test-utils'; | ||
import MaintenanceNotice from '@/components/Molecules/MaintenanceNotice.vue'; | ||
|
||
describe('MaintenanceNotice', () => { | ||
it('should show the message when current date is within the range', () => { | ||
jest.useFakeTimers().setSystemTime(new Date('2024-10-19T10:00:00+02:00')); | ||
const wrapper = shallowMount(MaintenanceNotice); | ||
expect(wrapper.vm.isMessageVisible).toBe(true); | ||
}); | ||
|
||
it('should not show the message when current date is outside the range', () => { | ||
jest.useFakeTimers().setSystemTime(new Date('2024-10-25T10:00:00+02:00')); | ||
const wrapper = shallowMount(MaintenanceNotice); | ||
expect(wrapper.vm.isMessageVisible).toBe(false); | ||
}); | ||
}); |