-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Mute Stripe test notifications (#2894)
- Loading branch information
1 parent
865691e
commit 04d3d22
Showing
2 changed files
with
75 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { GovUKPayment } from "@opensystemslab/planx-core/types"; | ||
import { isTestPayment } from "./utils"; | ||
|
||
describe("isTestPayment() helper function", () => { | ||
const OLD_ENV = process.env; | ||
|
||
beforeEach(() => { | ||
process.env = { ...OLD_ENV }; | ||
}); | ||
|
||
afterAll(() => { | ||
process.env = OLD_ENV; | ||
}); | ||
|
||
test("sandbox payments", () => { | ||
const result = isTestPayment({ | ||
payment_provider: "sandbox", | ||
} as GovUKPayment); | ||
expect(result).toBe(true); | ||
}); | ||
|
||
test("other payment providers", () => { | ||
const result = isTestPayment({ payment_provider: "Visa" } as GovUKPayment); | ||
expect(result).toBe(false); | ||
}); | ||
|
||
test("stripe payments (staging)", () => { | ||
process.env.APP_ENVIRONMENT = "staging"; | ||
const result = isTestPayment({ | ||
payment_provider: "stripe", | ||
} as GovUKPayment); | ||
expect(result).toBe(true); | ||
}); | ||
|
||
test("stripe payments (production)", () => { | ||
process.env.APP_ENVIRONMENT = "production"; | ||
const result = isTestPayment({ | ||
payment_provider: "stripe", | ||
} as GovUKPayment); | ||
expect(result).toBe(false); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters