From 895c6738cb4400de477d60d755aa9a832d12316a Mon Sep 17 00:00:00 2001 From: Miodec Date: Mon, 5 Jun 2023 18:07:00 +0200 Subject: [PATCH] added test that verified pb funbox check is working --- backend/__tests__/utils/pb.spec.ts | 35 ++++++++++++++++++++++++++++++ backend/jest.config.ts | 2 +- 2 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 backend/__tests__/utils/pb.spec.ts diff --git a/backend/__tests__/utils/pb.spec.ts b/backend/__tests__/utils/pb.spec.ts new file mode 100644 index 000000000..a008af3ab --- /dev/null +++ b/backend/__tests__/utils/pb.spec.ts @@ -0,0 +1,35 @@ +import _ from "lodash"; +import * as pb from "../../src/utils/pb"; + +describe("Pb Utils", () => { + it("funboxCatGetPb", () => { + const testCases = [ + { + funbox: "plus_one", + expected: true, + }, + { + funbox: "none", + expected: true, + }, + { + funbox: "nausea#plus_one", + expected: true, + }, + { + funbox: "arrows", + expected: false, + }, + ]; + + _.each(testCases, (testCase) => { + const { funbox, expected } = testCase; + //@ts-ignore ignore because this expects a whole result object + const result = pb.canFunboxGetPb({ + funbox, + }); + + expect(result).toBe(expected); + }); + }); +}); diff --git a/backend/jest.config.ts b/backend/jest.config.ts index 49e4dabb9..ab0f32781 100644 --- a/backend/jest.config.ts +++ b/backend/jest.config.ts @@ -9,7 +9,7 @@ export default { global: { // These percentages should never decrease statements: 40, - branches: 39, + branches: 38, functions: 25, lines: 43, },