Skip to content

Commit

Permalink
Merge pull request #454 from Esri/chore/100
Browse files Browse the repository at this point in the history
get coverage back to 100%
  • Loading branch information
jgravois authored Nov 28, 2018
2 parents ed5def1 + 6e37a12 commit c706730
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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({})
21 changes: 21 additions & 0 deletions packages/cedar/test/data/definitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
]
}
}
}
],
Expand Down
7 changes: 6 additions & 1 deletion packages/cedar/test/query/query.spec.ts
Original file line number Diff line number Diff line change
@@ -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'
Expand All @@ -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)
Expand All @@ -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
Expand Down Expand Up @@ -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]
Expand Down

0 comments on commit c706730

Please sign in to comment.