This repository was archived by the owner on May 4, 2023. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -12,6 +12,19 @@ export const TEST_USER = {
1212 accountType : "Github" ,
1313} ;
1414
15+ export const CODIGA_CONFIG_MISSING_RULESETS = `
16+ ` ;
17+
18+ export const CODIGA_CONFIG_MISSING_RULESETS_LIST = `
19+ rulesets:
20+ ` ;
21+
22+ export const CODIGA_CONFIG_MISSING_RULESETS_VALID = `
23+ rulesets:
24+ - react-best-practices
25+ - jsx-a11y
26+ ` ;
27+
1528export const executeCommand = async ( args ) => {
1629 try {
1730 return child_process . execSync ( `codiga ${ args . join ( " " ) } ` , {
Original file line number Diff line number Diff line change 1+ import { parseYamlFile } from "../utils/file" ;
2+ import {
3+ CODIGA_CONFIG_MISSING_RULESETS ,
4+ CODIGA_CONFIG_MISSING_RULESETS_LIST ,
5+ CODIGA_CONFIG_MISSING_RULESETS_VALID ,
6+ } from "./test-utils" ;
7+
8+ test ( "parse missing `rulesets:` correctly" , async ( ) => {
9+ expect ( parseYamlFile ( CODIGA_CONFIG_MISSING_RULESETS ) ) . toBe ( null ) ;
10+ } ) ;
11+
12+ test ( "parse missing rulesets list correctly" , async ( ) => {
13+ expect ( parseYamlFile ( CODIGA_CONFIG_MISSING_RULESETS_LIST ) ) . toEqual ( {
14+ rulesets : null ,
15+ } ) ;
16+ } ) ;
17+
18+ test ( "parse a valid file accurately" , async ( ) => {
19+ expect ( parseYamlFile ( CODIGA_CONFIG_MISSING_RULESETS_VALID ) ) . toEqual ( {
20+ rulesets : [ "react-best-practices" , "jsx-a11y" ] ,
21+ } ) ;
22+ } ) ;
You can’t perform that action at this time.
0 commit comments