Skip to content

Commit

Permalink
datasource change for better testing
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitryk-dk committed Jun 20, 2024
1 parent 05923fb commit c31b56e
Showing 1 changed file with 18 additions and 17 deletions.
35 changes: 18 additions & 17 deletions src/components/PrettifyQuery.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,26 +49,27 @@ const testQueries = [
}
]

const datasource = {
languageProvider: {
start: () => Promise.resolve([]),
syntax: () => {},
getLabelKeys: () => [],
metrics: [],
},
getInitHints: () => [],
prettifyRequest: async (expr: string) => {
return {
data: {
query: expr,
status: 'success'
}
}
}
} as unknown as PrometheusDatasource;

describe("Prettyfied Query", () => {
testQueries.forEach(async ({ name, got, want }) => {
it(`should prettify the query ${name}`, async () => {
const datasource = {
languageProvider: {
start: () => Promise.resolve([]),
syntax: () => {},
getLabelKeys: () => [],
metrics: [],
},
getInitHints: () => [],
prettifyRequest: async (_: string) => {
return {
data: {
query: got,
status: 'success'
}
}
}
} as unknown as PrometheusDatasource;

const mockCallback = jest.fn(resp => {
const { expr } = resp;
Expand Down

0 comments on commit c31b56e

Please sign in to comment.