Skip to content

Commit a763510

Browse files
test(strict): ensure strict rule options match strict config
1 parent 204801a commit a763510

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

tests/package.test.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,30 +52,34 @@ describe('package', () => {
5252
}
5353

5454
const namespace = 'rxjs-x';
55+
const recommendedRules = plugin.configs.recommended.rules;
56+
const strictRules = plugin.configs.strict.rules;
5557

5658
for (const [ruleName, rule] of Object.entries(plugin.rules)) {
5759
const fullRuleName = `${namespace}/${ruleName}`;
5860
const ruleRec = rule.meta.docs?.recommended;
5961

6062
if (!ruleRec) {
6163
// Rule is not part of any config.
62-
expect(plugin.configs.recommended.rules).not.toHaveProperty(fullRuleName);
63-
expect(plugin.configs.strict.rules).not.toHaveProperty(fullRuleName);
64+
expect(recommendedRules).not.toHaveProperty(fullRuleName);
65+
expect(strictRules).not.toHaveProperty(fullRuleName);
6466
} else if (typeof ruleRec === 'string') {
6567
// Rule is part of a single config.
6668
if (ruleRec === 'recommended') {
67-
expect(plugin.configs.recommended.rules).toHaveProperty(fullRuleName);
69+
expect(recommendedRules).toHaveProperty(fullRuleName);
6870
} else if (ruleRec === 'strict') {
69-
expect(plugin.configs.strict.rules).toHaveProperty(fullRuleName);
71+
expect(strictRules).toHaveProperty(fullRuleName);
7072
} else {
7173
expect.fail(`Invalid recommended value for rule ${fullRuleName}: ${ruleRec}`);
7274
}
7375
} else {
7476
// Rule is part of several configs.
7577
if (ruleRec.recommended) {
76-
expect(plugin.configs.recommended.rules).toHaveProperty(fullRuleName);
78+
expect(recommendedRules).toHaveProperty(fullRuleName);
7779
}
78-
expect(plugin.configs.strict.rules).toHaveProperty(fullRuleName);
80+
expect(strictRules).toHaveProperty(fullRuleName);
81+
expect(strictRules[fullRuleName as keyof typeof strictRules]).toBeInstanceOf(Array);
82+
expect(strictRules[fullRuleName as keyof typeof strictRules][1]).toEqual(ruleRec.strict[0]);
7983
}
8084
}
8185
});

0 commit comments

Comments
 (0)