Small Nest.js-based project
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

26 lines
949 B

import { createOpenmeteoClient } from './openmeteo';
describe('createOpenmeteoClient', () => {
const client = createOpenmeteoClient();
it('returns some weather for the sample address', async () => {
const result = await client.getCurrentWeather({
latitude: 52.28,
longitude: 10.52,
});
expect(result.apparentTemperature).toMatch(/^-?\d+(\.?\d+)?°C$/);
expect(result.temperature).toMatch(/^-?\d+(\.?\d+)?°C$/);
expect(result.relativeHumidity).toMatch(/^\d+%$/);
// Just to make sure that the returned weather seems to be reasonable
expect(result).not.toEqual({
apparentTemperature: '0°C',
temperature: '0°C',
relativeHumidity: '0%',
});
expect(result).not.toEqual({
apparentTemperature: '0.0°C',
temperature: '0.0°C',
relativeHumidity: '0%',
});
});
});