-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathis_prod_subworkflow.test.js
More file actions
41 lines (31 loc) · 1.2 KB
/
is_prod_subworkflow.test.js
File metadata and controls
41 lines (31 loc) · 1.2 KB
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
32
33
34
35
36
37
38
39
40
41
import assert from 'node:assert/strict'
import { describe, it } from 'node:test'
const {
default: component,
} = await import('./is_prod_subworkflow.js')
describe(component.name, () => {
it('should return not-prod if in build mode, even with production header', async () => {
component.headers = { 'x-is-production': 'true' }
const context = { 'test': true } // `test: true` means build mode.
const returnValue = await component.run({
$: { context }
})
assert.equal(returnValue, false)
})
it('should return not-prod if lacking production header, even if not in build mode', async () => {
component.headers = { 'user-agent': 'dummy-value' }
const context = { 'test': false } // `test: false` means not in build mode.
const returnValue = await component.run({
$: { context }
})
assert.equal(returnValue, false)
})
it('should return prod if given production header and not in build mode', async () => {
component.headers = { 'x-is-production': 'true' }
const context = { 'test': false } // `test: false` means not in build mode.
const returnValue = await component.run({
$: { context }
})
assert.equal(returnValue, true)
})
})