SSR-1127 Continue flow on load session fail

This commit is contained in:
Josh Dassinger 2024-08-05 08:30:33 -05:00
parent 71fa711843
commit 6c855b73a4
2 changed files with 69 additions and 91 deletions

View file

@ -1375,7 +1375,6 @@ export const useMainStore = defineStore({
async loadSession(duplicate) { async loadSession(duplicate) {
const { order, issConfig } = this; const { order, issConfig } = this;
try {
const response = await globalMethods.callHttpClient({ const response = await globalMethods.callHttpClient({
method: endpoints.LoadSession.method, method: endpoints.LoadSession.method,
endpoint: endpoints.LoadSession.url, endpoint: endpoints.LoadSession.url,
@ -1388,8 +1387,7 @@ export const useMainStore = defineStore({
}); });
const { data } = response; const { data } = response;
if (!data) { if (!data) {
// TODO how should we handle this case? return;
return response;
} }
if (this.isPolicyLookupSuccessful) { if (this.isPolicyLookupSuccessful) {
@ -1454,11 +1452,6 @@ export const useMainStore = defineStore({
order.eon = data?.eon; order.eon = data?.eon;
order.loadedFromDupeCheck = true; order.loadedFromDupeCheck = true;
order.loadedSessionClearedPreviousData = false; order.loadedSessionClearedPreviousData = false;
return data;
} catch (ex) {
// TODO how should we handle this case?
throw ex;
}
}, },
updateCreditCardToken(token) { updateCreditCardToken(token) {
this.order.payment.creditCardToken.subscriptionId = token.subscriptionId; this.order.payment.creditCardToken.subscriptionId = token.subscriptionId;

View file

@ -1107,21 +1107,6 @@ describe('Store', () => {
endpoint: endpoints.LoadSession.url endpoint: endpoints.LoadSession.url
})); }));
}); });
it('Returns expected response object', async () => {
// Arrange
const response = { data: { ReferralNumber: getRandomString(6, 6) } };
globalMethods.callHttpClient = jest.fn().mockReturnValue(Promise.resolve(response));
const duplicate = {
referralNumber: getRandomString(6, 6),
referralCorrelationId: getRandomGuid()
};
// Act
const result = store.loadSession(duplicate);
// Asserts
await expect(result).resolves.toBe(response.data);
});
it('sets expected vehicle data', async () => { it('sets expected vehicle data', async () => {
// Arrange // Arrange
globalMethods.callHttpClient = jest.fn().mockReturnValue(Promise.resolve(fullApiResponse)); globalMethods.callHttpClient = jest.fn().mockReturnValue(Promise.resolve(fullApiResponse));