test: OpenWeatherMap node test (#11989)

This commit is contained in:
Jon
2024-12-02 17:11:45 +00:00
committed by GitHub
parent d4e8d6778c
commit f258cebe53
3 changed files with 249 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
import nock from 'nock';
import { setup, equalityTest, workflowToTests, getWorkflowFilenames } from '@test/nodes/Helpers';
import { currentWeatherResponse } from './apiResponses';
describe('OpenWeatherMap', () => {
describe('Run OpenWeatherMap workflow', () => {
const workflows = getWorkflowFilenames(__dirname);
const tests = workflowToTests(workflows);
beforeAll(() => {
nock.disableNetConnect();
nock('https://api.openweathermap.org')
.get('/data/2.5/weather')
.query({ units: 'metric', q: 'berlin,de', lang: 'en' })
.reply(200, currentWeatherResponse);
});
afterAll(() => {
nock.restore();
});
const nodeTypes = setup(tests);
for (const testData of tests) {
test(testData.description, async () => await equalityTest(testData, nodeTypes));
}
});
});