Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Maurits Lourens committed Feb 11, 2022
1 parent 9ba6173 commit 7b182b1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
17 changes: 13 additions & 4 deletions packages/server/src/api/routes/tests/query.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ describe("/queries", () => {
parameters: {},
fields: {},
queryVerb: "read",
name: datasource.name,
})
.set(config.defaultHeaders())
.expect("Content-Type", /json/)
Expand Down Expand Up @@ -261,9 +262,13 @@ describe("/queries", () => {
})

it("check that it automatically retries on fail with cached dynamics", async () => {
const { datasource, query: base } = await config.dynamicVariableDatasource()
const { datasource, query: base } =
await config.dynamicVariableDatasource()
// preview once to cache
await preview(datasource, { path: "www.google.com", queryString: "test={{ variable3 }}" })
await preview(datasource, {
path: "www.google.com",
queryString: "test={{ variable3 }}",
})
// check its in cache
const contents = await checkCacheForDynamicVariable(base._id, "variable3")
expect(contents.rows.length).toEqual(1)
Expand All @@ -276,9 +281,13 @@ describe("/queries", () => {
})

it("deletes variables when linked query is deleted", async () => {
const { datasource, query: base } = await config.dynamicVariableDatasource()
const { datasource, query: base } =
await config.dynamicVariableDatasource()
// preview once to cache
await preview(datasource, { path: "www.google.com", queryString: "test={{ variable3 }}" })
await preview(datasource, {
path: "www.google.com",
queryString: "test={{ variable3 }}",
})
// check its in cache
let contents = await checkCacheForDynamicVariable(base._id, "variable3")
expect(contents.rows.length).toEqual(1)
Expand Down
1 change: 1 addition & 0 deletions packages/server/src/tests/utilities/TestConfiguration.js
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,7 @@ class TestConfiguration {
parameters: {},
fields,
queryVerb: "read",
name: datasource.name,
})
.set(config.defaultHeaders())
.expect("Content-Type", /json/)
Expand Down

0 comments on commit 7b182b1

Please sign in to comment.