feat: added e2ee test for recursive secret operation

This commit is contained in:
=
2024-11-29 19:45:10 +05:30
parent e676acbadf
commit c5fded361c
@@ -6,9 +6,10 @@ import { seedData1 } from "@app/db/seed-data";
describe("Secret Recursive Testing", async () => { describe("Secret Recursive Testing", async () => {
const projectId = seedData1.projectV3.id; const projectId = seedData1.projectV3.id;
const folderAndSecretNames = [ const folderAndSecretNames = [
{ name: "deep1", path: "/", expectedSecretCount: 3 }, { name: "deep1", path: "/", expectedSecretCount: 4 },
{ name: "deep2", path: "/deep1", expectedSecretCount: 2 }, { name: "deep21", path: "/deep1", expectedSecretCount: 2 },
{ name: "deep3", path: "/deep1/deep2", expectedSecretCount: 1 } { name: "deep3", path: "/deep1/deep2", expectedSecretCount: 1 },
{ name: "deep22", path: "/deep2", expectedSecretCount: 1 }
]; ];
beforeAll(async () => { beforeAll(async () => {
@@ -66,13 +67,16 @@ describe("Secret Recursive Testing", async () => {
}); });
expect(secrets.secrets.length).toEqual(expectedSecretCount); expect(secrets.secrets.length).toEqual(expectedSecretCount);
expect(secrets.secrets).toEqual( expect(secrets.secrets.sort((a, b) => a.secretKey.localeCompare(b.secretKey))).toEqual(
folderAndSecretNames.slice(-expectedSecretCount).map((el) => folderAndSecretNames
expect.objectContaining({ .filter((el) => el.path.startsWith(path))
secretKey: el.name, .sort((a, b) => a.name.localeCompare(b.name))
secretValue: el.name .map((el) =>
}) expect.objectContaining({
) secretKey: el.name,
secretValue: el.name
})
)
); );
}); });
}); });