pull:初次提交

This commit is contained in:
Yep_Q
2025-09-08 04:48:28 +08:00
parent 5c0619656d
commit f64f498365
11751 changed files with 1953723 additions and 0 deletions

View File

@@ -0,0 +1,40 @@
import { NodeTestHarness } from '@nodes-testing/node-test-harness';
import type { WorkflowTestData } from 'n8n-workflow';
jest.mock('otpauth', () => {
return {
TOTP: jest.fn().mockImplementation(() => {
return {
generate: jest.fn().mockReturnValue('123456'),
};
}),
};
});
describe('Execute TOTP node', () => {
const testHarness = new NodeTestHarness();
const tests: WorkflowTestData[] = [
{
description: 'Generate TOTP Token',
input: {
workflowData: testHarness.readWorkflowJSON('Totp.workflow.test.json'),
},
output: {
nodeData: {
// ignore json.secondsRemaining to prevent flakiness
TOTP: [[{ json: expect.objectContaining({ token: '123456' }) }]],
},
},
credentials: {
totpApi: {
label: 'GitHub:john-doe',
secret: 'BVDRSBXQB2ZEL5HE',
},
},
},
];
for (const testData of tests) {
testHarness.setupTest(testData);
}
});

View File

@@ -0,0 +1,41 @@
{
"nodes": [
{
"parameters": {},
"id": "f2e03169-0e94-4a42-821b-3e8f67f449d7",
"name": "When clicking \"Execute Workflow\"",
"type": "n8n-nodes-base.manualTrigger",
"typeVersion": 1,
"position": [580, 320]
},
{
"parameters": {
"additionalOptions": {}
},
"id": "831f657d-2724-4a25-bb94-cf37355654bb",
"name": "TOTP",
"type": "n8n-nodes-base.totp",
"typeVersion": 1,
"position": [800, 320],
"credentials": {
"totpApi": {
"id": "1",
"name": "TOTP account"
}
}
}
],
"connections": {
"When clicking \"Execute Workflow\"": {
"main": [
[
{
"node": "TOTP",
"type": "main",
"index": 0
}
]
]
}
}
}