當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript getQueryOptions.getQueryOptions函數代碼示例

本文整理匯總了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');
    });
開發者ID:johntdyer,項目名稱:grafana,代碼行數:10,代碼來源:datasource.test.ts

示例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();
    });
開發者ID:CorpGlory,項目名稱:grafana,代碼行數:13,代碼來源:datasource.test.ts

示例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);
      });
    });
開發者ID:johntdyer,項目名稱:grafana,代碼行數:14,代碼來源:InputDatasource.test.ts


注:本文中的test/helpers/getQueryOptions.getQueryOptions函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。