unit test WIP
This commit is contained in:
parent
14fb8f8d77
commit
14517035b1
1 changed files with 24 additions and 4 deletions
|
|
@ -479,22 +479,42 @@ describe('coverageStatement.vue', () => {
|
||||||
expect(wrapper.vm.coverageUnverified).toBeFalsy();
|
expect(wrapper.vm.coverageUnverified).toBeFalsy();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
describe('Navigation', () => {
|
||||||
|
test('Back button clicked triggers navigation', () => {
|
||||||
|
// Arrange
|
||||||
|
const wrapper = shallowMount(coverageStatement, getMountOptions({
|
||||||
|
router: {
|
||||||
|
navigate: jest.fn()
|
||||||
|
},
|
||||||
|
}));
|
||||||
|
mountOptions.mixins = [mockMixin];
|
||||||
|
|
||||||
|
// Act
|
||||||
|
wrapper.vm.backButtonAction();
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(wrapper.vm.$router.navigate).toHaveBeenCalled();
|
||||||
|
expect(wrapper.vm.$router.navigate)
|
||||||
|
.toHaveBeenCalledWith(navigationScenarios.CLICKED_BACK, undefined);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
})
|
})
|
||||||
|
//const testWidget = getRandomString(50, 100);
|
||||||
const mockMixin = {
|
const mockMixin = {
|
||||||
methods: {
|
methods: {
|
||||||
getCmsContent: jest.fn().mockImplementation(() => ''),
|
getCmsContent: jest.fn().mockImplementation(() => ''),
|
||||||
setCmsContent: jest.fn(),
|
setCmsContent: jest.fn(),
|
||||||
|
getBodyTextFromCms: jest.fn().mockImplementation(() => ''),
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
function setupMocks()
|
function setupMocks()
|
||||||
{
|
{
|
||||||
const mountOptions = getMountOptions({
|
const mountOptions = getMountOptions({
|
||||||
// router: {
|
router: {
|
||||||
// navigate: jest.fn()
|
navigate: jest.fn()
|
||||||
// },
|
},
|
||||||
|
|
||||||
// global: {
|
// global: {
|
||||||
// plugins: [createTestingPinia()]
|
// plugins: [createTestingPinia()]
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue