Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/templates/github/milestone.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,17 @@ const template: TemplateDefinition = {
label: 'Closed Issues',
type: 'number' as const,
defaultValue: 34,
min: 0,
max: 1000,
group: 'Content' as const,
},
{
key: 'total',
label: 'Total Issues',
type: 'number' as const,
defaultValue: 42,
min: 0,
max: 1000,
group: 'Content' as const,
},
{
Expand Down
4 changes: 4 additions & 0 deletions src/templates/github/sponsors-goal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,17 @@ const template: TemplateDefinition = {
label: 'Raised',
type: 'number' as const,
defaultValue: 420,
min: 0,
max: 10000,
group: 'Content' as const,
},
{
key: 'goal',
label: 'Goal',
type: 'number' as const,
defaultValue: 1000,
min: 0,
max: 10000,
group: 'Content' as const,
},
{
Expand Down
11 changes: 11 additions & 0 deletions tests/templates/registry.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,17 @@ describe('Template Registry', () => {
}
});

it('every number field default fits inside its slider range', () => {
for (const t of getAllTemplates()) {
for (const field of t.fields.filter((f) => f.type === 'number')) {
const value = Number(t.defaults[field.key] ?? field.defaultValue);
const where = `${t.id}.${field.key}`;
expect(value, where).toBeGreaterThanOrEqual(field.min ?? 0);
expect(value, where).toBeLessThanOrEqual(field.max ?? 100);
}
}
});

it('template IDs should be unique', () => {
const templates = getAllTemplates();
const ids = templates.map((t) => t.id);
Expand Down
Loading