Newer
Older
import mockConsole from 'jest-mock-console';
import sinon from 'sinon';
import {MOCK_SENSOR_THINGS_DATA} from 'ui/mock-service-data';
import {getSensorThingsURL, fetchDataFromSensorThings} from './sensor-things';
describe('web-services/sensor-things', () => {
let fakeServer;
let restoreConsole;
config.SENSOR_THINGS_ENDPOINT = 'fake-sensor-things-endpoint';
fakeServer = sinon.createFakeServer();
restoreConsole = mockConsole();
});
afterEach(() => {
fakeServer.restore();
restoreConsole();
});
describe('getSensorThingsURL', () => {
it('Expects url to contain combined agency and site number', () => {
const result = getSensorThingsURL('USGS-01646500', '00065');
expect(result).toContain("ParameterCode%20eq%20'00065'");
expect(result).toContain("substringOf('USGS-01646500'%2C%20description)");