本文整理汇总了TypeScript中test/helpers/getQueryOptions.getQueryOptions函数的典型用法代码示例。如果您正苦于以下问题:TypeScript getQueryOptions函数的具体用法?TypeScript getQueryOptions怎么用?TypeScript getQueryOptions使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getQueryOptions函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: test
test('should use default max lines when no limit given', () => {
const ds = new LokiDatasource(instanceSettings, backendSrv, templateSrvMock);
backendSrvMock.datasourceRequest = jest.fn(() => Promise.resolve(testResp));
const options = getQueryOptions<LokiQuery>({ targets: [{ expr: 'foo', refId: 'B' }] });
ds.query(options);
expect(backendSrvMock.datasourceRequest.mock.calls.length).toBe(1);
expect(backendSrvMock.datasourceRequest.mock.calls[0][0].url).toContain('limit=1000');
});
示例2: test
test('should return time series when resultFormat is time_series', async done => {
const ds = new LokiDatasource(instanceSettings, backendSrvMock, templateSrvMock);
backendSrvMock.datasourceRequest = jest.fn(() => Promise.resolve(testResp));
const options = getQueryOptions<LokiQuery>({
targets: [{ expr: 'foo', refId: 'B', resultFormat: 'time_series' }],
});
const res = await ds.query(options);
expect(res.data[0].datapoints).toBeDefined();
done();
});
示例3: test
test('should return the saved data with a query', () => {
const ds = new InputDatasource(instanceSettings);
const options = getQueryOptions<InputQuery>({
targets: [{ refId: 'Z' }],
});
return ds.query(options).then(rsp => {
expect(rsp.data.length).toBe(1);
const series = rsp.data[0];
expect(series.refId).toBe('Z');
expect(series.rows).toEqual(data[0].rows);
});
});