Skip to content

Commit 90f9366

Browse files
committed
test(models): check scoreTarget parsing for categories
1 parent 4f5fd09 commit 90f9366

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

packages/models/src/lib/category-config.unit.test.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,30 @@ describe('categoryConfigSchema', () => {
121121
).not.toThrow();
122122
});
123123

124+
it('should accept a valid category configuration with a score target', () => {
125+
expect(() =>
126+
categoryConfigSchema.parse({
127+
slug: 'core-web-vitals',
128+
title: 'Core Web Vitals',
129+
scoreTarget: 0.9,
130+
refs: [
131+
{
132+
plugin: 'lighthouse',
133+
slug: 'largest-contentful-paint',
134+
type: 'audit',
135+
weight: 3,
136+
},
137+
{
138+
plugin: 'lighthouse',
139+
slug: 'first-input-delay',
140+
type: 'audit',
141+
weight: 2,
142+
},
143+
],
144+
} satisfies CategoryConfig),
145+
).not.toThrow();
146+
});
147+
124148
it('should throw for an empty category', () => {
125149
expect(() =>
126150
categoryConfigSchema.parse({

0 commit comments

Comments
 (0)