forked from zwaldowski/match-label-action
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.test.js
31 lines (28 loc) · 886 Bytes
/
index.test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
const cp = require('child_process')
const path = require('path')
const process = require('process')
const test = require('ava')
test('test runs', (t) => {
process.env.INPUT_ALLOWED = 'hello,world'
process.env.GITHUB_EVENT_PATH = path.join(__dirname, '.tests/context.json')
const ip = path.join(__dirname, 'index.js')
const output = cp.execSync(`node ${ip}`, {
env: process.env,
encoding: 'utf8'
})
t.is(output, '\n::set-output name=match::hello\n')
})
test('test runs w/prefix', (t) => {
process.env.INPUT_PREFIX = 'target@'
process.env.INPUT_ALLOWED = 'hello,world'
process.env.GITHUB_EVENT_PATH = path.join(
__dirname,
'.tests/context_prefix.json'
)
const ip = path.join(__dirname, 'index.js')
const output = cp.execSync(`node ${ip}`, {
env: process.env,
encoding: 'utf8'
})
t.is(output, '\n::set-output name=match::hello\n')
})