Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Will Binns-Smith committed Apr 14, 2020
1 parent 0ee8a3c commit fc51293
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 12 deletions.
14 changes: 9 additions & 5 deletions packages/core/integration-tests/test/html.js
Expand Up @@ -329,8 +329,8 @@ describe('html', function() {

// mergeStyles
assert(
html.includes(
'<style>h1{color:red}div{font-size:20px}</style><style media="print">div{color:#00f}</style>',
html.match(
/<style>h1{color:red}div{font-size:20px}\n\/\*# sourceMappingURL=.*\*\/<\/style><style media="print">div{color:#00f}\n\/\*# sourceMappingURL=.*\*\/<\/style>/,
),
);

Expand Down Expand Up @@ -834,7 +834,11 @@ describe('html', function() {
path.join(distDir, 'index.html'),
'utf8',
);
assert(html.includes('<style>.index{color:#00f}</style>'));
assert(
html.match(
/<style>.index{color:#00f}\n\/\*# sourceMappingURL=.*<\/style>/,
),
);
});

it('should process inline non-js scripts', async function() {
Expand Down Expand Up @@ -1159,8 +1163,8 @@ describe('html', function() {
path.join(distDir, html.match(/\/a\.[a-z0-9]+\.css/)[0]),
'utf8',
);
assert(css.includes('.a'));
assert(!css.includes('.b'));
assert(css.includes('.a {'));
assert(!css.includes('.b {'));

// b.html should point to a CSS bundle containing only b.css
// It should not point to the bundle containing a.css from a.html
Expand Down
10 changes: 6 additions & 4 deletions packages/core/integration-tests/test/javascript.js
Expand Up @@ -2099,15 +2099,17 @@ describe('javascript', function() {
path.join(__dirname, '/integration/bundle-text/index.js'),
);

assert.equal(
(await run(b)).default,
`body {
assert(
(await run(b)).default.startsWith(
`body {
background-color: #000000;
}
.svg-img {
background-image: url("data:image/svg+xml,%3Csvg%3E%0A%0A%3C%2Fsvg%3E%0A");
}`,
}
/*# sourceMappingURL=data:application/json;charset=utf-8;base64,`,
),
);
});

Expand Down
2 changes: 1 addition & 1 deletion packages/core/integration-tests/test/less.js
Expand Up @@ -108,7 +108,7 @@ describe('less', function() {
assert.equal(output(), 2);

let css = await outputFS.readFile(path.join(distDir, 'index.css'), 'utf8');
assert.equal(css, '');
assert.equal(css.trim(), '/*# sourceMappingURL=index.css.map */');
});

it('should support linking to assets with url() from less', async function() {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/integration-tests/test/sass.js
Expand Up @@ -101,7 +101,7 @@ describe('sass', function() {
assert.equal(output(), 2);

let css = await outputFS.readFile(path.join(distDir, 'index.css'), 'utf8');
assert.equal(css, '');
assert.equal(css.trim(), '/*# sourceMappingURL=index.css.map */');
});

it('should support linking to assets with url() from scss', async function() {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/test-utils/src/utils.js
Expand Up @@ -508,7 +508,7 @@ function prepareNodeContext(filePath, globals) {
return ctx;
}

export function shallowEqual(a, b) {
export function shallowEqual(a: {|+[string]: mixed|}, b: {|+[string]: mixed|}) {
if (Object.keys(a).length !== Object.keys(b).length) {
return false;
}
Expand Down

0 comments on commit fc51293

Please sign in to comment.