mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 02:35:49 +00:00
test(env) add
This commit is contained in:
parent
8fcb28a0dd
commit
91fee46a59
1 changed files with 38 additions and 0 deletions
38
test/server/env.js
Normal file
38
test/server/env.js
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
'use strict';
|
||||
|
||||
const test = require('tape');
|
||||
const env = require('../../server/env');
|
||||
|
||||
test('env: small', (t) => {
|
||||
process.env.cloudcmd_hello = 'world';
|
||||
t.equal(env('hello'), 'world', 'should parse string from env');
|
||||
|
||||
delete process.env.cloudcmd_hello;
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('env: big', (t) => {
|
||||
process.env.CLOUDCMD_HELLO = 'world';
|
||||
t.equal(env('hello'), 'world', 'should parse string from env');
|
||||
|
||||
delete process.env.CLOUDCMD_HELLO;
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('env: bool', (t) => {
|
||||
process.env.cloudcmd_terminal = 'false';
|
||||
t.notOk(env.bool('terminal'), 'should return false');
|
||||
|
||||
delete process.env.cloudcmd_terminal;
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('env: bool', (t) => {
|
||||
process.env.cloudcmd_terminal = 'true';
|
||||
|
||||
t.ok(env.bool('terminal'), 'should be true');
|
||||
|
||||
delete process.env.cloudcmd_terminal;
|
||||
t.end();
|
||||
});
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue