diff --git a/packages/builder/src/stores/backend/queries.js b/packages/builder/src/stores/backend/queries.js index ea016f50bc..e7980988cc 100644 --- a/packages/builder/src/stores/backend/queries.js +++ b/packages/builder/src/stores/backend/queries.js @@ -68,6 +68,7 @@ export function createQueriesStore() { return state }) + return response; }, } } diff --git a/packages/builder/src/stores/backend/tests/queries.spec.js b/packages/builder/src/stores/backend/tests/queries.spec.js index 7e5019d97c..d1efd678f9 100644 --- a/packages/builder/src/stores/backend/tests/queries.spec.js +++ b/packages/builder/src/stores/backend/tests/queries.spec.js @@ -37,15 +37,14 @@ describe("Queries Store", () => { 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}) await store.select(SOME_QUERY.datasourceId, SOME_QUERY) expect(get(store).list).toEqual(expect.arrayContaining([SOME_QUERY])) }) - it("deletes a datasource, updates the store and returns status message", async () => { - console.log('After Fetch: ', get(store)) + it("deletes a query, updates the store and returns status message", async () => { api.delete.mockReturnValue({status: 200, message: `Query deleted.`})