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();
|
||||
});
|
||||
});
|
||||
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 = {
|
||||
methods: {
|
||||
getCmsContent: jest.fn().mockImplementation(() => ''),
|
||||
setCmsContent: jest.fn(),
|
||||
getBodyTextFromCms: jest.fn().mockImplementation(() => ''),
|
||||
},
|
||||
};
|
||||
|
||||
function setupMocks()
|
||||
{
|
||||
const mountOptions = getMountOptions({
|
||||
// router: {
|
||||
// navigate: jest.fn()
|
||||
// },
|
||||
router: {
|
||||
navigate: jest.fn()
|
||||
},
|
||||
|
||||
// global: {
|
||||
// plugins: [createTestingPinia()]
|
||||
|
|
|
|||
Loading…
Reference in a new issue