Skip to content

Commit f80537a

Browse files
committed
Update tests
1 parent b2b95d5 commit f80537a

File tree

3 files changed

+9
-10
lines changed

3 files changed

+9
-10
lines changed

__tests__/applyAtRule.test.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import postcss from 'postcss'
22
import plugin from '../src/lib/substituteClassApplyAtRules'
33

4-
function run(input, opts) {
4+
function run(input, opts = () => {}) {
55
return postcss([plugin(opts)]).process(input)
66
}
77

88
test("it copies a class's declarations into itself", () => {
99
const output = '.a { color: red; } .b { color: red; }'
1010

11-
return run('.a { color: red; } .b { @apply .a; }', {}).then(result => {
11+
return run('.a { color: red; } .b { @apply .a; }').then(result => {
1212
expect(result.css).toEqual(output)
1313
expect(result.warnings().length).toBe(0)
1414
})
@@ -38,16 +38,15 @@ test("it doesn't copy a media query definition into itself", () => {
3838
3939
.b {
4040
@apply .a;
41-
}`,
42-
{}
43-
).then(result => {
41+
}`)
42+
.then(result => {
4443
expect(result.css).toEqual(output)
4544
expect(result.warnings().length).toBe(0)
4645
})
4746
})
4847

4948
test('it fails if the class does not exist', () => {
50-
run('.b { @apply .a; }', {}).catch(error => {
49+
run('.b { @apply .a; }').catch(error => {
5150
expect(error.reason).toEqual('No .a class found.')
5251
})
5352
})

__tests__/focusableAtRule.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import postcss from 'postcss'
22
import plugin from '../src/lib/substituteFocusableAtRules'
33

4-
function run(input, opts = {}) {
4+
function run(input, opts = () => {}) {
55
return postcss([plugin(opts)]).process(input)
66
}
77

@@ -18,7 +18,7 @@ test("it adds a focusable variant to each nested class definition", () => {
1818
.chocolate, .focus\\:chocolate:focus { color: brown; }
1919
`
2020

21-
return run(input, {}).then(result => {
21+
return run(input).then(result => {
2222
expect(result.css).toEqual(output)
2323
expect(result.warnings().length).toBe(0)
2424
})

__tests__/hoverableAtRule.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import postcss from 'postcss'
22
import plugin from '../src/lib/substituteHoverableAtRules'
33

4-
function run(input, opts = {}) {
4+
function run(input, opts = () => {}) {
55
return postcss([plugin(opts)]).process(input)
66
}
77

@@ -18,7 +18,7 @@ test("it adds a hoverable variant to each nested class definition", () => {
1818
.chocolate, .hover\\:chocolate:hover { color: brown; }
1919
`
2020

21-
return run(input, {}).then(result => {
21+
return run(input).then(result => {
2222
expect(result.css).toEqual(output)
2323
expect(result.warnings().length).toBe(0)
2424
})

0 commit comments

Comments
 (0)