diff --git a/src/services/__tests__/adeli-resquest.spec.ts b/src/services/__tests__/adeli-resquest.spec.ts index 928741c1..5c1dcfbf 100644 --- a/src/services/__tests__/adeli-resquest.spec.ts +++ b/src/services/__tests__/adeli-resquest.spec.ts @@ -5,6 +5,7 @@ import { requestAdeli } from "../adeli/request"; jest.mock("axios"); describe("requestAdeli", () => { beforeEach(() => { + (axios.get as jest.Mock).mockReset(); // @ts-ignore axios.get.mockImplementation(() => Promise.resolve({ data: { rows: [] } })); }); @@ -23,6 +24,7 @@ describe("requestAdeli", () => { ${"123"} ${"1 2 3"} ${"1.2...3"} + ${"00/00/01/23"} `("should call api endpoint if adeli is $input", async ({ input }) => { const result = await requestAdeli(input); expect(axios.get).toHaveBeenCalledWith( diff --git a/src/services/adeli/request.ts b/src/services/adeli/request.ts index 9ef47d7b..b024599e 100644 --- a/src/services/adeli/request.ts +++ b/src/services/adeli/request.ts @@ -5,7 +5,7 @@ import { zip } from "../../utils/array"; import config from "../config"; const formatRequestedAdeli = (adeliId: string) => - adeliId.replace(".", "").replace(" ", "").replace("/", "").padStart(10, "0"); + adeliId.replace(/\./g, "").replace(/ /g, "").replace(/\//g, "").padStart(10, "0"); const rowColumnsToObject = (row: string[], columns: Column[]) => Object.fromEntries(zip(columns, row));