File tree Expand file tree Collapse file tree 1 file changed +34
-0
lines changed
nodes/DependencyAnalytics Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change 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-' ) || / ^ @ [ ^ / ] + \/ n 8 n - n o d e s - / . 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+ } ) ;
You can’t perform that action at this time.
0 commit comments