refactor: Overhaul nodes-testing setup - Part 2 (no-changelog) (#14873)

This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™
2025-04-24 17:37:26 +02:00
committed by GitHub
parent 897338bd24
commit 91069f057e
119 changed files with 556 additions and 1002 deletions

View File

@@ -69,11 +69,9 @@ describe('Test Gmail Node v1', () => {
.reply(200, messages[0]);
});
testWorkflows(['nodes/Google/Gmail/test/v1/messages.workflow.json']);
afterAll(() => gmailNock.done());
it('should make the correct network calls', () => {
gmailNock.done();
});
testWorkflows(['nodes/Google/Gmail/test/v1/messages.workflow.json']);
});
describe('Labels', () => {
@@ -94,11 +92,9 @@ describe('Test Gmail Node v1', () => {
});
});
testWorkflows(['nodes/Google/Gmail/test/v1/labels.workflow.json']);
afterAll(() => gmailNock.done());
it('should make the correct network calls', () => {
gmailNock.done();
});
testWorkflows(['nodes/Google/Gmail/test/v1/labels.workflow.json']);
});
describe('Message Labels', () => {
@@ -113,11 +109,9 @@ describe('Test Gmail Node v1', () => {
.reply(200, messages[0]);
});
testWorkflows(['nodes/Google/Gmail/test/v1/message-labels.workflow.json']);
afterAll(() => gmailNock.done());
it('should make the correct network calls', () => {
gmailNock.done();
});
testWorkflows(['nodes/Google/Gmail/test/v1/message-labels.workflow.json']);
});
describe('Drafts', () => {
@@ -193,10 +187,8 @@ describe('Test Gmail Node v1', () => {
});
});
testWorkflows(['nodes/Google/Gmail/test/v1/drafts.workflow.json']);
afterAll(() => gmailNock.done());
it('should make the correct network calls', () => {
gmailNock.done();
});
testWorkflows(['nodes/Google/Gmail/test/v1/drafts.workflow.json']);
});
});

View File

@@ -129,11 +129,9 @@ describe('Test Gmail Node v2', () => {
.reply(200, messages[0]);
});
testWorkflows(['nodes/Google/Gmail/test/v2/messages.workflow.json']);
afterAll(() => gmailNock.done());
it('should make the correct network calls', () => {
gmailNock.done();
});
testWorkflows(['nodes/Google/Gmail/test/v2/messages.workflow.json']);
});
describe('Labels', () => {
@@ -154,11 +152,9 @@ describe('Test Gmail Node v2', () => {
});
});
testWorkflows(['nodes/Google/Gmail/test/v2/labels.workflow.json']);
afterAll(() => gmailNock.done());
it('should make the correct network calls', () => {
gmailNock.done();
});
testWorkflows(['nodes/Google/Gmail/test/v2/labels.workflow.json']);
});
describe('Drafts', () => {
@@ -244,11 +240,9 @@ describe('Test Gmail Node v2', () => {
});
});
testWorkflows(['nodes/Google/Gmail/test/v2/drafts.workflow.json']);
afterAll(() => gmailNock.done());
it('should make the correct network calls', () => {
gmailNock.done();
});
testWorkflows(['nodes/Google/Gmail/test/v2/drafts.workflow.json']);
});
describe('Threads', () => {
@@ -307,11 +301,9 @@ describe('Test Gmail Node v2', () => {
.reply(200, messages[0]);
});
testWorkflows(['nodes/Google/Gmail/test/v2/threads.workflow.json']);
afterAll(() => gmailNock.done());
it('should make the correct network calls', () => {
gmailNock.done();
});
testWorkflows(['nodes/Google/Gmail/test/v2/threads.workflow.json']);
});
describe('loadOptions', () => {

View File

@@ -8,6 +8,15 @@ import playlistItems from './fixtures/playlistItems.json';
import playlists from './fixtures/playlists.json';
describe('Test YouTube Node', () => {
const credentials = {
youTubeOAuth2Api: {
scope: '',
oauthTokenData: {
access_token: 'ACCESSTOKEN',
},
},
};
const youtubeNock = nock('https://www.googleapis.com/youtube');
beforeAll(() => {
jest
@@ -51,16 +60,11 @@ describe('Test YouTube Node', () => {
image: {},
},
});
nock.emitter.on('no match', (req) => {
console.error('Unmatched request:', req);
});
});
testWorkflows(['nodes/Google/YouTube/__test__/node/channels.workflow.json']);
afterAll(() => youtubeNock.done());
it('should make the correct network calls', () => {
youtubeNock.done();
});
testWorkflows(['nodes/Google/YouTube/__test__/node/channels.workflow.json'], credentials);
});
describe('Playlist', () => {
@@ -107,16 +111,11 @@ describe('Test YouTube Node', () => {
})
.reply(200, { items: playlists });
youtubeNock.delete('/v3/playlists', { id: 'playlist_id_1' }).reply(200, { success: true });
nock.emitter.on('no match', (req) => {
console.error('Unmatched request:', req);
});
});
testWorkflows(['nodes/Google/YouTube/__test__/node/playlists.workflow.json']);
afterAll(() => youtubeNock.done());
it('should make the correct network calls', () => {
youtubeNock.done();
});
testWorkflows(['nodes/Google/YouTube/__test__/node/playlists.workflow.json'], credentials);
});
describe('Video Categories', () => {
@@ -128,17 +127,16 @@ describe('Test YouTube Node', () => {
regionCode: 'GB',
})
.reply(200, { items: categories });
nock.emitter.on('no match', (req) => {
console.error('Unmatched request:', req);
});
});
testWorkflows(['nodes/Google/YouTube/__test__/node/videoCategories.workflow.json']);
afterAll(() => youtubeNock.done());
it('should make the correct network calls', () => {
youtubeNock.done();
});
testWorkflows(
['nodes/Google/YouTube/__test__/node/videoCategories.workflow.json'],
credentials,
);
});
describe('Playlist Item', () => {
beforeAll(() => {
youtubeNock
@@ -171,15 +169,10 @@ describe('Test YouTube Node', () => {
return body.id === 'UExWUDRtV2RxbGFhNWlwZEJRWXZVaFgyNk9RTENJRlV2cS41NkI0NEY2RDEwNTU3Q0M2';
})
.reply(200, {});
nock.emitter.on('no match', (req) => {
console.error('Unmatched request:', req);
});
});
testWorkflows(['nodes/Google/YouTube/__test__/node/playlistItems.workflow.json']);
afterAll(() => youtubeNock.done());
// it('should make the correct network calls', () => {
// youtubeNock.done();
// });
testWorkflows(['nodes/Google/YouTube/__test__/node/playlistItems.workflow.json'], credentials);
});
});