Skip to content

Commit d0144b2

Browse files
bartvenemanBart Veneman
andauthored
adds regression test (#50)
Co-authored-by: Bart Veneman <bart.veneman@drukwerkdeal.nl>
1 parent 8256be0 commit d0144b2

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@
1414
"get-css"
1515
],
1616
"scripts": {
17-
"test": "eslint ./src ./test && ava"
17+
"test": "ava && npm run lint",
18+
"ava": "ava",
19+
"lint": "eslint ./src ./test"
1820
},
1921
"files": [
2022
"src"
@@ -37,4 +39,4 @@
3739
"eslintConfig": {
3840
"extends": "@bartveneman/eslint-config-bv"
3941
}
40-
}
42+
}

test/index.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,17 @@ test('it finds css in a <style> tag - HTML', async t => {
4040
t.snapshot(actual)
4141
})
4242

43+
// This is an issue with chrome-aws-lambda, so let's make sure
44+
// it doesn't happen here too.
45+
test('it reports CSS in a <style> tag in HTML only once', async t => {
46+
const actual = await extractCss(server.url + '/style-tag-html.html')
47+
48+
const firstOccurence = actual.indexOf('.fixture')
49+
const lastOccurence = actual.lastIndexOf('.fixture')
50+
51+
t.is(firstOccurence, lastOccurence)
52+
})
53+
4354
test('it finds css in a <style> tag - JS', async t => {
4455
const actual = await extractCss(server.url + '/style-tag-js.html')
4556

@@ -84,7 +95,7 @@ test('it finds inline styles - JS', async t => {
8495
t.snapshot(actual)
8596
})
8697

87-
test('it yields an array of entries when the `origins` option equals `include`', async t => {
98+
test('it returns an array of entries when the `origins` option equals `include`', async t => {
8899
const actual = await extractCss(server.url + '/kitchen-sink.html', {
89100
origins: 'include'
90101
})

0 commit comments

Comments
 (0)