update query store

This commit is contained in:
Keviin Åberg Kultalahti 2021-03-29 17:52:38 +02:00
parent e1034ae5ac
commit 292a891883
2 changed files with 3 additions and 3 deletions

View File

@ -68,6 +68,7 @@ export function createQueriesStore() {
return state return state
}) })
return response;
}, },
} }
} }

View File

@ -37,15 +37,14 @@ describe("Queries Store", () => {
expect(get(datasources).selected).toEqual(SOME_QUERY.datasourceId) expect(get(datasources).selected).toEqual(SOME_QUERY.datasourceId)
}) })
it("saves the datasource, updates the store and returns status message", async () => { it("saves the query, updates the store and returns status message", async () => {
api.post.mockReturnValue({ json: () => SAVE_QUERY_RESPONSE}) api.post.mockReturnValue({ json: () => SAVE_QUERY_RESPONSE})
await store.select(SOME_QUERY.datasourceId, SOME_QUERY) await store.select(SOME_QUERY.datasourceId, SOME_QUERY)
expect(get(store).list).toEqual(expect.arrayContaining([SOME_QUERY])) expect(get(store).list).toEqual(expect.arrayContaining([SOME_QUERY]))
}) })
it("deletes a datasource, updates the store and returns status message", async () => { it("deletes a query, updates the store and returns status message", async () => {
console.log('After Fetch: ', get(store))
api.delete.mockReturnValue({status: 200, message: `Query deleted.`}) api.delete.mockReturnValue({status: 200, message: `Query deleted.`})