Merge pull request #519 from Safelite/feature/CSR-622

CSR-622 Don't load if referralNumber is empty
This commit is contained in:
Frank Rua 2022-05-31 03:22:52 -06:00 committed by GitHub
commit 62ef851b4e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 4 deletions

View file

@ -11,8 +11,8 @@ import baseMixin from "@/mixins/base-mixin";
export async function loadOrderIfPresent() {
const funnelCookie = getFunnelCookie();
// Do nothing if there is no cookie or no correlation id.
if (funnelCookie == null || funnelCookie.ReferralCorrelationId == null) {
// Do nothing if there is no cookie, correlation id, or referral number.
if (funnelCookie == null || funnelCookie.ReferralCorrelationId == null || !funnelCookie.ReferralNumber) {
return null;
}

View file

@ -18,7 +18,8 @@ describe("loadOrderIfPresent", () => {
const testCookieValue = {
ShouldResetState: testShouldResetState,
ReferralCorrelationId: "xxx"
ReferralCorrelationId: "xxx",
ReferralNumber: "12345"
}
document.cookie = `${cookieNames.FUNNEL_SESSION_INFO}=${JSON.stringify(testCookieValue)}; path=/; ${cookieHelper.getCookieDomainValue()}`;
@ -33,7 +34,11 @@ describe("loadOrderIfPresent", () => {
test("ShouldResetState == true => reset store", () => {
// Arrange
cookieHelper.getFunnelCookie = jest.spyOn(cookieHelper, "getFunnelCookie").mockReturnValueOnce({ ShouldResetState: true, ReferralCorrelationId: "xxx-xxx-xxx" });
cookieHelper.getFunnelCookie = jest.spyOn(cookieHelper, "getFunnelCookie").mockReturnValueOnce({
ShouldResetState: true,
ReferralCorrelationId: "xxx-xxx-xxx",
ReferralNumber: "12345"
});
const mockData = {
actionList: [{