Skip to content

Commit

Permalink
✅ add db tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sophiamersmann committed Oct 3, 2024
1 parent 33b85da commit 52f2595
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions adminSiteServer/app.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -776,4 +776,36 @@ describe("OwidAdminApp: indicator-level chart configs", () => {
expect(configAfterUpdate).not.toBeNull()
expect(chartAfterUpdate).toEqual(configAfterUpdate)
})

it("should return an error if the schema is missing", async () => {
const invalidConfig = {
title: "Title",
// note that the $schema field is missing
}
const json = await makeRequestAgainstAdminApi(
{
method: "PUT",
path: `/variables/${variableId}/grapherConfigETL`,
body: JSON.stringify(invalidConfig),
},
{ verifySuccess: false }
)
expect(json.success).toBe(false)
})

it("should return an error if the schema is invalid", async () => {
const invalidConfig = {
$schema: "invalid", // note that the $schema field is invalid
title: "Title",
}
const json = await makeRequestAgainstAdminApi(
{
method: "PUT",
path: `/variables/${variableId}/grapherConfigETL`,
body: JSON.stringify(invalidConfig),
},
{ verifySuccess: false }
)
expect(json.success).toBe(false)
})
})

0 comments on commit 52f2595

Please sign in to comment.