Skip to content

Commit a3c5950

Browse files
committed
feat: update test descriptions for clarity and remove redundant tests
1 parent b87c1f5 commit a3c5950

File tree

2 files changed

+11
-48
lines changed

2 files changed

+11
-48
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,3 +103,5 @@ dist
103103
# TernJS port file
104104
.tern-port
105105
package-lock.json
106+
107+
.vscode/

index.test.js

Lines changed: 9 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@ describe('postcss-unit-processor', () => {
7676
);
7777
});
7878

79-
// Test media query processing
80-
it('should process units in media queries when enabled', async () => {
79+
// Test media query parameter processing
80+
it('should process units in media query parameters when enabled', async () => {
8181
const processor = (value, unit) => {
8282
if (unit === 'px') {
8383
return { value: value * 2, unit: 'px' };
@@ -91,8 +91,8 @@ describe('postcss-unit-processor', () => {
9191
);
9292
});
9393

94-
// Test media query processing disabled
95-
it('should not process units in media queries when disabled', async () => {
94+
// Test media query parameter processing disabled
95+
it('should not process units in media query parameters when disabled', async () => {
9696
const processor = (value, unit) => {
9797
if (unit === 'px') {
9898
return { value: value * 2, unit: 'px' };
@@ -134,45 +134,6 @@ describe('postcss-unit-processor', () => {
134134
await testProcess(input, output, { processor, replace: false });
135135
});
136136

137-
// Test exclude option with function
138-
it('should process CSS when file path is undefined', async () => {
139-
const processor = (value, unit) => {
140-
if (unit === 'px') {
141-
return { value: value * 2, unit: 'px' };
142-
}
143-
return { value, unit };
144-
};
145-
const input = 'div { width: 100px; }';
146-
const output = 'div { width: 200px; }';
147-
await testProcess(input, output, { processor, exclude: (file) => file && file.includes('test') });
148-
});
149-
150-
// Test exclude option with string
151-
it('should process CSS when file path does not match exclude string', async () => {
152-
const processor = (value, unit) => {
153-
if (unit === 'px') {
154-
return { value: value * 2, unit: 'px' };
155-
}
156-
return { value, unit };
157-
};
158-
const input = 'div { width: 100px; }';
159-
const output = 'div { width: 200px; }';
160-
await testProcess(input, output, { processor, exclude: 'test/path' });
161-
});
162-
163-
// Test exclude option with regex
164-
it('should process CSS when file path does not match exclude regex', async () => {
165-
const processor = (value, unit) => {
166-
if (unit === 'px') {
167-
return { value: value * 2, unit: 'px' };
168-
}
169-
return { value, unit };
170-
};
171-
const input = 'div { width: 100px; }';
172-
const output = 'div { width: 200px; }';
173-
await testProcess(input, output, { processor, exclude: /test\/path/ });
174-
});
175-
176137
// Test property list with wildcard patterns
177138
it('should process properties with wildcard patterns', async () => {
178139
const processor = (value, unit) => {
@@ -302,16 +263,16 @@ describe('postcss-unit-processor', () => {
302263
);
303264
});
304265

305-
// Test blacklistedSelector with non-string selector
306-
it('should handle non-string selector in blacklist check', async () => {
266+
// Test selector not in blacklist
267+
it('should process units when selector does not match blacklist', async () => {
307268
const processor = (value, unit) => {
308269
if (unit === 'px') {
309270
return { value: value * 2, unit: 'px' };
310271
}
311272
return { value, unit };
312273
};
313274

314-
// Create CSS with a rule that has no selector
275+
// Create CSS with a selector that doesn't match blacklist
315276
const input = 'div { width: 100px; }';
316277
const result = await postcss([unitProcessor({ processor, selectorBlackList: ['test'] })])
317278
.process(input, { from: undefined });
@@ -419,8 +380,8 @@ describe('postcss-unit-processor', () => {
419380
expect(result.css).toEqual('@media (max-width: 600px) { div { width: 100px; } }');
420381
});
421382

422-
// Test blacklistedSelector function directly by manipulating parent selector
423-
it('should handle selector blacklist check with edge cases', async () => {
383+
// Test blacklistedSelector function with undefined selector
384+
it('should handle undefined selector in blacklist check', async () => {
424385
const processor = (value, unit) => {
425386
if (unit === 'px') {
426387
return { value: value * 2, unit: 'px' };

0 commit comments

Comments
 (0)