Skip to content

Conversation

tidoust
Copy link
Member

@tidoust tidoust commented Jun 4, 2025

This adds tests to guarantee that entries are unique in the consolidated CSS file (they should be by construction, tests are meant to capture bugs that we might miss if we update the consolidation logic in Reffy).

Consolidation amends syntaxes of some of the entries. Tests also make sure that syntaxes can be parsed with CSSTree.

This adds tests to guarantee that entries are unique in the consolidated CSS
file (they should be by construction, tests are meant to capture bugs that we
might miss if we update the consolidation logic in Reffy).

Consolidation amends syntaxes of some of the entries. Tests also make sure that
syntaxes can be parsed with CSSTree.
@tidoust tidoust requested a review from dontcallmedom June 4, 2025 15:44
Comment on lines 12 to 20
atrules: { singular: 'at-rule', plural: 'at-rules' },
functions: { singular: 'function', plural: 'functions' },
properties: { singular: 'property', plural: 'properties' },
selectors: { singular: 'selector', plural: 'selectors' },
types: { singular: 'type', plural: 'types' }
};

describe(`The consolidated CSS file`, async () => {
for (const [category, { singular, plural }] of Object.entries(categories)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
atrules: { singular: 'at-rule', plural: 'at-rules' },
functions: { singular: 'function', plural: 'functions' },
properties: { singular: 'property', plural: 'properties' },
selectors: { singular: 'selector', plural: 'selectors' },
types: { singular: 'type', plural: 'types' }
};
describe(`The consolidated CSS file`, async () => {
for (const [category, { singular, plural }] of Object.entries(categories)) {
```suggestion
atrules: { singular: 'at-rule' },
functions: { singular: 'function' },
properties: { singular: 'property', plural: 'properties' },
selectors: { singular: 'selector' },
types: { singular: 'type' }
};
describe(`The consolidated CSS file`, async () => {
for (const [category, { singular, plural = singular + 's' }] of Object.entries(categories)) {

if we're being pedantic, let's at least be lazy about it :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I pushed a lazier version that avoids the destructuring syntax with a default value, which always makes me pose. Coz' DRY is fine but KISS too!

@tidoust tidoust merged commit 5d17c89 into main Jun 4, 2025
1 check passed
@tidoust tidoust deleted the css-tests branch June 4, 2025 16:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants