Merge pull request #519 from Safelite/feature/CSR-622
CSR-622 Don't load if referralNumber is empty
This commit is contained in:
commit
62ef851b4e
2 changed files with 9 additions and 4 deletions
|
|
@ -11,8 +11,8 @@ import baseMixin from "@/mixins/base-mixin";
|
||||||
export async function loadOrderIfPresent() {
|
export async function loadOrderIfPresent() {
|
||||||
const funnelCookie = getFunnelCookie();
|
const funnelCookie = getFunnelCookie();
|
||||||
|
|
||||||
// Do nothing if there is no cookie or no correlation id.
|
// Do nothing if there is no cookie, correlation id, or referral number.
|
||||||
if (funnelCookie == null || funnelCookie.ReferralCorrelationId == null) {
|
if (funnelCookie == null || funnelCookie.ReferralCorrelationId == null || !funnelCookie.ReferralNumber) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,8 @@ describe("loadOrderIfPresent", () => {
|
||||||
|
|
||||||
const testCookieValue = {
|
const testCookieValue = {
|
||||||
ShouldResetState: testShouldResetState,
|
ShouldResetState: testShouldResetState,
|
||||||
ReferralCorrelationId: "xxx"
|
ReferralCorrelationId: "xxx",
|
||||||
|
ReferralNumber: "12345"
|
||||||
}
|
}
|
||||||
|
|
||||||
document.cookie = `${cookieNames.FUNNEL_SESSION_INFO}=${JSON.stringify(testCookieValue)}; path=/; ${cookieHelper.getCookieDomainValue()}`;
|
document.cookie = `${cookieNames.FUNNEL_SESSION_INFO}=${JSON.stringify(testCookieValue)}; path=/; ${cookieHelper.getCookieDomainValue()}`;
|
||||||
|
|
@ -33,7 +34,11 @@ describe("loadOrderIfPresent", () => {
|
||||||
|
|
||||||
test("ShouldResetState == true => reset store", () => {
|
test("ShouldResetState == true => reset store", () => {
|
||||||
// Arrange
|
// 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 = {
|
const mockData = {
|
||||||
actionList: [{
|
actionList: [{
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue