CASH-619 test fixes
CASH-619 test fixes
This commit is contained in:
parent
2ec1f65f12
commit
79732a079e
2 changed files with 13 additions and 1 deletions
|
|
@ -55,6 +55,16 @@ function setupMocks() {
|
||||||
fetchCmsContentForPage.mockResolvedValue(mockCmsContent);
|
fetchCmsContentForPage.mockResolvedValue(mockCmsContent);
|
||||||
settleAllPromises.mockResolvedValue({ cmsContent: mockCmsContent });
|
settleAllPromises.mockResolvedValue({ cmsContent: mockCmsContent });
|
||||||
|
|
||||||
|
|
||||||
|
const mockMixin = {
|
||||||
|
methods: {
|
||||||
|
getCmsContent: jest.fn((widgetName, fieldName) => {
|
||||||
|
return mockCmsContent?.[widgetName]?.[fieldName] ?? "";
|
||||||
|
}),
|
||||||
|
setCmsContent: jest.fn(),
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
const mountOptions = getMountOptions({
|
const mountOptions = getMountOptions({
|
||||||
route: { name: "duplicate-check", query: {}, params: {} },
|
route: { name: "duplicate-check", query: {}, params: {} },
|
||||||
router: {
|
router: {
|
||||||
|
|
@ -62,6 +72,7 @@ function setupMocks() {
|
||||||
navigateWithSaving: jest.fn(),
|
navigateWithSaving: jest.fn(),
|
||||||
navigateWithoutSaving: jest.fn(),
|
navigateWithoutSaving: jest.fn(),
|
||||||
},
|
},
|
||||||
|
mixins: [mockMixin],
|
||||||
});
|
});
|
||||||
|
|
||||||
const wrapper = shallowMount(duplicateCheck, mountOptions);
|
const wrapper = shallowMount(duplicateCheck, mountOptions);
|
||||||
|
|
|
||||||
|
|
@ -109,7 +109,8 @@ export default {
|
||||||
},
|
},
|
||||||
startNewClaimAnswers() {
|
startNewClaimAnswers() {
|
||||||
const answers = this.getCmsContent("StartNewClaimWidget", "Answers");
|
const answers = this.getCmsContent("StartNewClaimWidget", "Answers");
|
||||||
return answers.map(answer => ({
|
if (!Array.isArray(answers)) return [];
|
||||||
|
return answers.map((answer) => ({
|
||||||
buttonLabel: answer.Text,
|
buttonLabel: answer.Text,
|
||||||
value: answer.Name,
|
value: answer.Name,
|
||||||
}));
|
}));
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue