From 6e37a128222ff7192fca2b10c45435c5202107bc Mon Sep 17 00:00:00 2001 From: john gravois Date: Tue, 27 Nov 2018 16:11:42 -0800 Subject: [PATCH] get coverage back to :100:% --- .../@esri/arcgis-rest-feature-service.ts | 1 + packages/cedar/test/data/definitions.ts | 21 +++++++++++++++++++ packages/cedar/test/query/query.spec.ts | 7 ++++++- 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/packages/cedar/__mocks__/@esri/arcgis-rest-feature-service.ts b/packages/cedar/__mocks__/@esri/arcgis-rest-feature-service.ts index 735fc184..a107a33d 100644 --- a/packages/cedar/__mocks__/@esri/arcgis-rest-feature-service.ts +++ b/packages/cedar/__mocks__/@esri/arcgis-rest-feature-service.ts @@ -3,3 +3,4 @@ import {} from 'jest' // stub queryFeatures to resolve an empty object // instead of actually fetching features export const queryFeatures = jest.fn().mockResolvedValue({}) +export const decodeValues = jest.fn().mockResolvedValue({}) diff --git a/packages/cedar/test/data/definitions.ts b/packages/cedar/test/data/definitions.ts index 6a20bec4..b0010555 100644 --- a/packages/cedar/test/data/definitions.ts +++ b/packages/cedar/test/data/definitions.ts @@ -15,6 +15,27 @@ export const bar = { "outStatisticFieldName": "Number_of_SUM" } ] + }, + "domains": { + "sheltstat": { + "type": "codedValue", + "name": "ShelterCode", + "description": "Shelter Codes", + "codedValues": [ + { + "name": "Open", + "code": 1 + }, + { + "name": "Closed", + "code": 2 + }, + { + "name": "Full", + "code": 3 + } + ] + } } } ], diff --git a/packages/cedar/test/query/query.spec.ts b/packages/cedar/test/query/query.spec.ts index 9fb8ffff..2495c52f 100644 --- a/packages/cedar/test/query/query.spec.ts +++ b/packages/cedar/test/query/query.spec.ts @@ -1,5 +1,5 @@ // NOTE: this is auto-mocked in __mocks__ -import { queryFeatures } from '@esri/arcgis-rest-feature-service' +import { queryFeatures, decodeValues } from '@esri/arcgis-rest-feature-service' import {} from 'jest' import config from '../../src/config' import { queryDatasets } from '../../src/query/query' @@ -10,6 +10,9 @@ import * as definitions from '../data/definitions' // TODO: how to tell TS that type of queryFeatures is a jest mock function??? const mockQueryFeatures = (queryFeatures as any) +const mockDecodeValues = (decodeValues as any) + + // TODO: ues actual requestOptions type const verifyRequestOptions = (dataset, requestOptions: any, expectedFetch = undefined) => { expect(requestOptions.url).toEqual(dataset.url) @@ -33,6 +36,7 @@ describe('when querying datasets', () => { describe('when a single dataset', () => { beforeEach(() => { mockQueryFeatures.mockClear() + mockDecodeValues.mockClear() }) describe('when that dataset has a name', () => { const datasets = definitions.bar.datasets @@ -88,6 +92,7 @@ describe('when querying datasets', () => { describe('when multiple datasets', () => { beforeEach(() => { mockQueryFeatures.mockClear() + mockDecodeValues.mockClear() }) describe('when one has inline data', () => { const barDataset = definitions.bar.datasets[0]