Skip to content

Commit

Permalink
test(getStrapiEntries): remove unneeded
Browse files Browse the repository at this point in the history
  • Loading branch information
chohner committed Dec 13, 2024
1 parent aea8283 commit 33a5552
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 31 deletions.
12 changes: 2 additions & 10 deletions app/services/cms/__test__/getStrapiEntryFromApi.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import axios from "axios";
import { getStrapiEntryFromApi } from "~/services/cms/getStrapiEntryFromApi";
import {
defaultLocale,
stagingLocale,
} from "~/services/cms/models/StrapiLocale";
import { stagingLocale } from "~/services/cms/models/StrapiLocale";
import type { GetStrapiEntryOpts } from "../filters";

const API_URL = "test://cms/api/";
Expand All @@ -23,17 +20,12 @@ describe("services/cms", () => {
apiId: "pages",
locale: stagingLocale,
};
const defaultResponseData = { data: { data: dataResponse } };
const emptyResponseData = { data: [] };
const expectedRequestUrl = `${API_URL}pages?populate=*&pLevel&locale=de`;
const expectedStagingRequestUrl = `${API_URL}pages?populate=*&pLevel&locale=sg`;

const axiosGetSpy = vi.spyOn(axios, "get");

beforeEach(() => {
axiosGetSpy
.mockResolvedValue(defaultResponseData)
.mockResolvedValueOnce(emptyResponseData);
axiosGetSpy.mockResolvedValue({ data: { data: dataResponse } });
});

afterEach(() => {
Expand Down
21 changes: 0 additions & 21 deletions app/services/cms/__test__/getStrapiEntryFromFile.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,6 @@ describe("services/cms", () => {
).toEqual([footerData]);
});

describe("when no entry exists for the given locale", () => {
it("returns default entry", async () => {
expect(
await getStrapiEntryFromFile({
apiId: "footer",
locale: "en",
}),
).toEqual([footerData]);
});
});

it("can filter by property", async () => {
expect(
await getStrapiEntryFromFile({
Expand Down Expand Up @@ -127,15 +116,5 @@ describe("services/cms", () => {
}),
).toStrictEqual([]);
});

it("falls back to default locale", async () => {
expect(
await getStrapiEntryFromFile({
apiId: "pages",
filters: [{ field: "slug", value: impressumPath }],
locale: "en",
}),
).toEqual([impressum]);
});
});
});

0 comments on commit 33a5552

Please sign in to comment.