Skip to content

Commit 9e1f0e0

Browse files
authored
test: Test for the N8N standards (#67)
1 parent bf68107 commit 9e1f0e0

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import * as fs from 'node:fs';
2+
import * as path from 'node:path';
3+
4+
describe('n8n community node package standards (package.json)', () => {
5+
const pkgPath = path.resolve(process.cwd(), 'package.json');
6+
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8')) as any;
7+
8+
test('package name starts with n8n-nodes- or @<scope>/n8n-nodes-', () => {
9+
const name = pkg?.name;
10+
expect(typeof name).toBe('string');
11+
12+
const ok = name.startsWith('n8n-nodes-') || /^@[^/]+\/n8n-nodes-/.test(name);
13+
expect(ok).toBe(true);
14+
});
15+
16+
test('package keywords include n8n-community-node-package', () => {
17+
const keywords = pkg?.keywords;
18+
expect(Array.isArray(keywords)).toBe(true);
19+
expect(keywords).toContain('n8n-community-node-package');
20+
});
21+
22+
test('package.json includes nodes and credentials under the n8n attribute', () => {
23+
expect(pkg).toHaveProperty('n8n');
24+
25+
const nodes = pkg?.n8n?.nodes;
26+
const credentials = pkg?.n8n?.credentials;
27+
28+
expect(Array.isArray(nodes)).toBe(true);
29+
expect(nodes.length).toBeGreaterThan(0);
30+
31+
expect(Array.isArray(credentials)).toBe(true);
32+
expect(credentials.length).toBeGreaterThan(0);
33+
});
34+
});

0 commit comments

Comments
 (0)