2015-09-01 10:31:00 +03:00
|
|
|
/*
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright (c) 2015, Joyent, Inc.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Integration tests for `triton ...` CLI basics.
|
|
|
|
*/
|
|
|
|
|
|
|
|
var h = require('./helpers');
|
|
|
|
var test = require('tape');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// --- Globals
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// --- Tests
|
|
|
|
|
|
|
|
test('triton (basics)', function (tt) {
|
|
|
|
|
|
|
|
tt.test(' triton --version', function (t) {
|
|
|
|
h.triton('--version', function (err, stdout, stderr) {
|
|
|
|
if (h.ifErr(t, err, 'triton --version'))
|
|
|
|
return t.end();
|
2017-01-12 21:48:47 +02:00
|
|
|
t.ok(/^Triton CLI \d+\.\d+\.\d+/.test(stdout),
|
|
|
|
'version on first line');
|
|
|
|
t.ok(/^https:/m.test(stdout), 'project link in version output');
|
2015-09-01 10:31:00 +03:00
|
|
|
t.end();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
tt.test(' triton -h', function (t) {
|
|
|
|
h.triton('-h', function (err, stdout, stderr) {
|
|
|
|
if (h.ifErr(t, err))
|
|
|
|
return t.end();
|
|
|
|
t.ok(/^Usage:$/m.test(stdout));
|
|
|
|
t.ok(/triton help COMMAND/.test(stdout));
|
2016-01-04 20:52:50 +02:00
|
|
|
t.ok(/instance/.test(stdout));
|
2015-09-01 10:31:00 +03:00
|
|
|
t.end();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
tt.test(' triton --help', function (t) {
|
|
|
|
h.triton('--help', function (err, stdout, stderr) {
|
|
|
|
if (h.ifErr(t, err))
|
|
|
|
return t.end();
|
|
|
|
t.ok(/^Usage:$/m.test(stdout));
|
|
|
|
t.ok(/triton help COMMAND/.test(stdout));
|
2016-01-04 20:52:50 +02:00
|
|
|
t.ok(/instance/.test(stdout));
|
2015-09-01 10:31:00 +03:00
|
|
|
t.end();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
tt.test(' triton help', function (t) {
|
|
|
|
h.triton('help', function (err, stdout, stderr) {
|
|
|
|
if (h.ifErr(t, err))
|
|
|
|
return t.end();
|
|
|
|
t.ok(/^Usage:$/m.test(stdout));
|
|
|
|
t.ok(/triton help COMMAND/.test(stdout));
|
2016-01-04 20:52:50 +02:00
|
|
|
t.ok(/instance/.test(stdout));
|
2015-09-01 10:31:00 +03:00
|
|
|
t.end();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|