-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
22846 - add unit tests for component (#747)
* 22846 - show resolution dates in amalgamations * 22846 - fixes after review 1 * 22846 - fixes after review 2 * 22846 - fixes after review 3 * 22846 - update package version * 22846 - add unit tests * 22846 - update package version
- Loading branch information
1 parent
6be0690
commit 6b170b8
Showing
4 changed files
with
65 additions
and
4 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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,61 @@ | ||
import Vuetify from 'vuetify' | ||
import { createPinia, setActivePinia } from 'pinia' | ||
import ListResolutions from '@/components/common/ListResolutions.vue' | ||
import { useStore } from '@/store/store' | ||
import { mount } from '@vue/test-utils' | ||
|
||
const vuetify = new Vuetify({}) | ||
setActivePinia(createPinia()) | ||
const store = useStore() | ||
|
||
describe('List Resolutions component', () => { | ||
let wrapper: any | ||
|
||
const resolutionList = [ | ||
{ | ||
'date': '2024-07-15', | ||
'id': 123456, | ||
'type': 'SPECIAL' | ||
}, | ||
{ | ||
'date': '2024-07-17', | ||
'id': 123457, | ||
'type': 'SPECIAL' | ||
}, | ||
{ | ||
'date': '2024-07-18', | ||
'id': 123458, | ||
'type': 'SPECIAL' | ||
}, | ||
{ | ||
'date': '2024-08-15', | ||
'id': 123459, | ||
'type': 'SPECIAL' | ||
} | ||
] | ||
|
||
it('ddoes not display resolutions if list is empty', () => { | ||
store.stateModel.resolutions = [] | ||
wrapper = mount(ListResolutions, { vuetify }) | ||
|
||
expect(wrapper.find('#resolution-list').exists()).toBe(false) | ||
expect(wrapper.find('#resolution-label').exists()).toBeFalsy() | ||
|
||
wrapper.destroy() | ||
}) | ||
|
||
it('displays the correct number and dates of resolutions', () => { | ||
store.stateModel.resolutions = resolutionList | ||
wrapper = mount(ListResolutions, { vuetify }) | ||
|
||
const list = wrapper.find('#resolution-list') | ||
const td = list.findAll('tr > td') | ||
|
||
expect(wrapper.find('#resolution-label').exists()).toBeTruthy() | ||
expect(td.length).toBe(4) | ||
expect(td.at(0).text()).toBe('2024-07-15') | ||
expect(td.at(3).text()).toBe('2024-08-15') | ||
|
||
wrapper.destroy() | ||
}) | ||
}) |