Refactor
This commit is contained in:
parent
cf906df1db
commit
d8f52ed821
3 changed files with 10 additions and 26 deletions
|
|
@ -178,20 +178,7 @@ describe('welcome-page.vue', () => {
|
|||
describe('navigation', () => {
|
||||
test('if duplicates found, navigate to duplicate check page', async () => {
|
||||
// Arrange
|
||||
const accountNumber = getRandomString(5, 5);
|
||||
const policyNumber = getRandomString(5, 5);
|
||||
const dateOfLoss = getRandomString(5, 5);
|
||||
const { wrapper } = getMountedComponent({
|
||||
order: {
|
||||
policy: {
|
||||
policyNumber: policyNumber,
|
||||
dateOfLoss: dateOfLoss
|
||||
}
|
||||
},
|
||||
issConfig: {
|
||||
accountNumber: accountNumber
|
||||
}
|
||||
});
|
||||
const { wrapper } = getMountedComponent({});
|
||||
|
||||
const duplicatesExist = {
|
||||
policyLookupResponse: {},
|
||||
|
|
@ -204,12 +191,7 @@ describe('navigation', () => {
|
|||
await wrapper.vm.forwardButtonAction();
|
||||
|
||||
// Assert
|
||||
expect(wrapper.vm.mainStore.getDuplicates).toHaveBeenCalledWith(
|
||||
{
|
||||
accountNumber: accountNumber,
|
||||
policyNumber: policyNumber,
|
||||
dateOfLoss: dateOfLoss
|
||||
});
|
||||
expect(wrapper.vm.mainStore.getDuplicateReferrals).toHaveBeenCalled();
|
||||
expect(wrapper.vm.$router.navigate).toHaveBeenCalledWith(
|
||||
navigationScenarios.CLICKED_FORWARD_WITH_DUPLICATES,
|
||||
undefined,
|
||||
|
|
|
|||
|
|
@ -298,11 +298,7 @@ export default {
|
|||
methods: {
|
||||
async forwardButtonAction() {
|
||||
this.mainStore.updatePolicyData(this.welcomePageModel);
|
||||
const duplicateCheckResponse = useMainStore().getDuplicates({
|
||||
accountNumber: this.mainStore.issConfig.accountNumber.toString(),
|
||||
policyNumber: this.mainStore.order.policy.policyNumber,
|
||||
dateOfLoss: this.mainStore.order.policy.dateOfLoss
|
||||
});
|
||||
const duplicateCheckResponse = useMainStore().getDuplicateReferrals();
|
||||
const duplicatePromiseResultMap = [
|
||||
{
|
||||
resultKey: 'duplicateCheckResponse',
|
||||
|
|
|
|||
|
|
@ -470,7 +470,13 @@ export const useMainStore = defineStore({
|
|||
});
|
||||
},
|
||||
// TODO when endpoint finished replace dummy data with api call
|
||||
getDuplicates({accountNumber, policyNumber, dateOfLoss}) {
|
||||
getDuplicateReferrals() {
|
||||
const apiInputs = [
|
||||
this.issConfig.accountNumber,
|
||||
this.order.policy.policyNumber,
|
||||
this.order.policy.dateOfLoss
|
||||
];
|
||||
|
||||
return [
|
||||
{
|
||||
referralNumber: "12345",
|
||||
|
|
|
|||
Loading…
Reference in a new issue