Permalink
Browse files

Refactor tests

Identification fragment changed:
- old: module.exports
- new: RIOT_TAG_IS
  • Loading branch information...
1 parent 2fa48f5 commit 20e56f589943063e5714ee6cc55e1381cc70ed8c @cognitom cognitom committed Nov 25, 2016
Showing with 13 additions and 13 deletions.
  1. +13 −13 test/compile.js
View
@@ -16,7 +16,7 @@ test('ignore', t => {
p.pipe(concat(out => {
t.ok(out[0], 'got output element')
t.ok(out[0].source.length, 'got output element with source')
- t.ok(out[0].source.match(/^<todo>/), 'skipped ignore.ext')
+ t.ok(/^<todo>/.test(out[0].source), 'skipped ignore.ext')
}))
})
@@ -31,11 +31,11 @@ test('compile', t => {
t.plan(6)
p.pipe(concat(out => {
t.is(out.length, 2, 'got two files as output')
- t.ok(out[0].id.match(/riot\.js$/), 'out.0 is riot.js')
- t.ok(out[0].source.match(/module.exports/), 'riot.js')
- t.ok(out[1].id.match(/todo\.tag$/), 'out.1 is todo.tag')
- t.ok(out[1].source.match(/var riot = require\('riot'\);/), 'require riot')
- t.ok(out[1].source.match(/riot.tag2\(.*todo/), 'compiled compile.tag')
+ t.ok(/riot\.js$/.test(out[0].id), 'out.0 is riot.js')
+ t.ok(/RIOT_TAG_IS/.test(out[0].source), 'riot.js')
+ t.ok(/todo\.tag$/.test(out[1].id), 'out.1 is todo.tag')
+ t.ok(/var riot = require\('riot'\);/.test(out[1].source), 'require riot')
+ t.ok(/riot\.tag2\(.*todo/.test(out[1].source), 'compiled compile.tag')
}))
})
@@ -50,11 +50,11 @@ test('compile-custom-ext', t => {
t.plan(6)
p.pipe(concat(out => {
t.is(out.length, 2, 'got two files as output')
- t.ok(out[0].id.match(/riot\.js$/), 'out.0 is riot.js')
- t.ok(out[0].source.match(/module.exports/), 'riot.js')
- t.ok(out[1].id.match(/customext\.html$/), 'out.1 is customext.html')
- t.ok(out[1].source.match(/var riot = require\('riot'\);/), 'require riot')
- t.ok(out[1].source.match(/riot.tag2\(.*customext/), 'compiled compile.tag')
+ t.ok(/riot\.js$/.test(out[0].id), 'out.0 is riot.js')
+ t.ok(/RIOT_TAG_IS/.test(out[0].source), 'riot.js')
+ t.ok(/customext\.html$/.test(out[1].id), 'out.1 is customext.html')
+ t.ok(/var riot = require\('riot'\);/.test(out[1].source), 'require riot')
+ t.ok(/riot.tag2\(.*customext/.test(out[1].source), 'compiled compile.tag')
}))
})
@@ -70,7 +70,7 @@ test('compile-custom-ext-ignore', t => {
p.pipe(concat(out => {
t.ok(out[0], 'got output element')
t.ok(out[0].source.length, 'got output element with source')
- t.ok(out[0].source.match(/^<todo>/), 'skipped todo.tag')
+ t.ok(/^<todo>/.test(out[0].source), 'skipped todo.tag')
}))
})
@@ -84,6 +84,6 @@ test('module exports riot tag', t => {
t.plan(1)
p.pipe(concat(out => {
- t.ok(out[1].source.match(/module.exports = riot.tag2/), 'riot tag')
+ t.ok(/module.exports = riot.tag2/.test(out[1].source), 'riot tag')
}))
})

0 comments on commit 20e56f5

Please sign in to comment.