Skip to content
This repository has been archived by the owner on Dec 28, 2023. It is now read-only.

Commit

Permalink
Fix map tests in options.js
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel F. Dickinson <dfdpublic@wildtechgarden.ca>
  • Loading branch information
danielfdickinson committed Apr 3, 2022
1 parent 7a982de commit a8b9686
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions __tests__/options.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,15 @@ let tests = [{
fixture: 'h1{width:10.000px}',
expected: 'h1 {\n width: 10.000px;\n}\n',
options: {trimTrailingZeros: false},
}, {
}];

let mapTests = [{
message: 'should expand css',
fixture: 'h1{color:black}',
expected: 'h1 {\n color: black;\n}\n',
options: {map: true},
}, {
}, {
message: 'should expand css (2)',
fixture: 'h1{color:black}',
expected: 'h1 {\n color: black;\n}\n',
options: {map: false, sourcemap: true},
}];

Expand All @@ -76,7 +76,14 @@ function perfectionistDFD (css, options) {
}

ava('perfectionistDFD options', (t) => {
tests.forEach(({fixture, expected, options}) => {
t.deepEqual(perfectionistDFD(fixture, options || {}), expected);
tests.forEach(({fixture, expected, options, message}) => {
t.deepEqual(perfectionistDFD(fixture, options || {}), expected, message);
});
});

ava('perfectionistDFD map options', (t) => {
mapTests.forEach(({fixture, options, message}) => {
const hasMap = /sourceMappingURL=data:application\/json;base64/.test(perfectionistDFD(fixture, options || {}));
t.truthy(hasMap, message);
});
});

0 comments on commit a8b9686

Please sign in to comment.