Skip to content

Commit fc5662b

Browse files
committed
test: no array or object passed with disabled strict mode
1 parent 2c0c0d1 commit fc5662b

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

test/test-loops.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,11 @@ function process (t, name, options, log = false) {
2727
})
2828
}
2929

30-
function error (name, cb) {
31-
return posthtml([expressions()])
30+
function error (name, cbErr, cbSuccess, pluginOptions) {
31+
return posthtml([expressions(pluginOptions)])
3232
.process(fixture(name))
33-
.catch(cb)
33+
.then(cbSuccess)
34+
.catch(cbErr)
3435
}
3536

3637
function clean (html) {
@@ -99,10 +100,16 @@ test('Loops - no loop attribute', (t) => {
99100

100101
test('Loops - no array or object passed', (t) => {
101102
return error('loop_no_collection', (err) => {
102-
t.truthy(err.toString() === 'Error: You must provide an array or object to loop through')
103+
t.is(err.toString(), 'Error: You must provide an array or object to loop through')
103104
})
104105
})
105106

107+
test('Loops - no array or object passed with disabled strict mode', (t) => {
108+
return error('loop_no_collection', () => {}, (response) => {
109+
t.truthy(response)
110+
}, { strictMode: false })
111+
})
112+
106113
test('Loops - no loop arguments', (t) => {
107114
return error('loop_no_args', (err) => {
108115
t.truthy(err.toString() === 'Error: You must provide at least one loop argument')

0 commit comments

Comments
 (0)