Files
n8n/packages/nodes-base/nodes/Github/__tests__/Github.user.getRepositories.test.ts
alighasami 3d5eaf9445
Security: Sync from Public / sync-from-public (push) Has been cancelled
Test: Benchmark Nightly / build (push) Has been cancelled
Test: Benchmark Nightly / Notify Cats on failure (push) Has been cancelled
CI: Python / Checks (push) Has been cancelled
Test: Evals Python / Workflow Comparison Python (push) Has been cancelled
Util: Check Docs URLs / check-docs-urls (push) Has been cancelled
Test: Visual Storybook / Cloudflare Pages (push) Has been cancelled
Test: E2E Performance / build-and-test-performance (push) Has been cancelled
Test: Workflows Nightly / Run Workflow Tests (push) Has been cancelled
Util: Cleanup CI Docker Images / Delete stale CI images (push) Has been cancelled
Test: Benchmark Destroy Env / build (push) Has been cancelled
Util: Update Node Popularity / update-popularity (push) Has been cancelled
Test: E2E Coverage Weekly / Coverage Tests (push) Has been cancelled
first commit
2026-03-17 16:22:57 +03:30

143 lines
3.4 KiB
TypeScript

import { NodeTestHarness } from '@nodes-testing/node-test-harness';
import nock from 'nock';
describe('Github Node - User getRepositories', () => {
const credentials = {
githubApi: {
accessToken: 'test-token',
server: 'https://api.github.com',
user: 'testuser',
},
};
describe('Basic User getRepositories Operation', () => {
beforeAll(() => {
const mock = nock('https://api.github.com');
mock
.get('/users/testuser/repos')
.query(true)
.reply(200, [
{
id: 1296269,
name: 'hello-world',
full_name: 'testuser/hello-world',
owner: {
login: 'testuser',
id: 1,
type: 'User',
},
private: false,
html_url: 'https://github.com/testuser/hello-world',
description: 'My first repository on GitHub!',
fork: false,
created_at: '2011-01-26T19:01:12Z',
updated_at: '2011-01-26T19:14:43Z',
pushed_at: '2011-01-26T19:06:43Z',
clone_url: 'https://github.com/testuser/hello-world.git',
size: 108,
stargazers_count: 80,
watchers_count: 9,
language: 'C',
forks_count: 9,
archived: false,
disabled: false,
open_issues_count: 0,
license: {
key: 'mit',
name: 'MIT License',
},
visibility: 'public',
default_branch: 'master',
},
{
id: 1296270,
name: 'my-app',
full_name: 'testuser/my-app',
owner: {
login: 'testuser',
id: 1,
type: 'User',
},
private: false,
html_url: 'https://github.com/testuser/my-app',
description: 'My awesome application',
fork: false,
created_at: '2011-02-26T19:01:12Z',
updated_at: '2011-02-26T19:14:43Z',
pushed_at: '2011-02-26T19:06:43Z',
clone_url: 'https://github.com/testuser/my-app.git',
size: 512,
stargazers_count: 156,
watchers_count: 45,
language: 'JavaScript',
forks_count: 23,
archived: false,
disabled: false,
open_issues_count: 5,
license: {
key: 'apache-2.0',
name: 'Apache License 2.0',
},
visibility: 'public',
default_branch: 'main',
},
]);
});
new NodeTestHarness().setupTests({
credentials,
workflowFiles: ['getUserRepositories.workflow.json'],
});
});
describe('Limited User getRepositories Operation', () => {
beforeAll(() => {
const mock = nock('https://api.github.com');
mock
.get('/users/testuser/repos')
.query({ per_page: 1 })
.reply(200, [
{
id: 1296269,
name: 'hello-world',
full_name: 'testuser/hello-world',
owner: {
login: 'testuser',
id: 1,
type: 'User',
},
private: false,
html_url: 'https://github.com/testuser/hello-world',
description: 'My first repository on GitHub!',
fork: false,
created_at: '2011-01-26T19:01:12Z',
updated_at: '2011-01-26T19:14:43Z',
pushed_at: '2011-01-26T19:06:43Z',
clone_url: 'https://github.com/testuser/hello-world.git',
size: 108,
stargazers_count: 80,
watchers_count: 9,
language: 'C',
forks_count: 9,
archived: false,
disabled: false,
open_issues_count: 0,
license: {
key: 'mit',
name: 'MIT License',
},
visibility: 'public',
default_branch: 'master',
},
]);
});
new NodeTestHarness().setupTests({
credentials,
workflowFiles: ['getUserRepositoriesLimit.workflow.json'],
});
});
});