unit test WIP

This commit is contained in:
Katie Kroell 2023-07-25 14:30:58 -04:00
parent 14fb8f8d77
commit 14517035b1

View file

@ -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()]