-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #184 from newrelic-forks/master
tests: add command-exists tests
- Loading branch information
Showing
4 changed files
with
37 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,5 @@ tmp/ | |
.idea/ | ||
vendor/ | ||
.bundle | ||
out | ||
out | ||
.vscode/ |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// Copyright 2017 TODO Group. All rights reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
const chai = require('chai') | ||
const expect = chai.expect | ||
const { commandExists } = require('../../lib/command_exists') | ||
|
||
describe('lib', () => { | ||
describe('command_exists', function () { | ||
it('should detect a command exists', async () => { | ||
const res = await commandExists('ssh') | ||
expect(res).to.equal('ssh') | ||
}) | ||
|
||
it('should detect a command doesn\'t exists', async () => { | ||
const res = await commandExists('notacommand') | ||
expect(res).to.equal(null) | ||
}) | ||
|
||
it('should detect one of the commands exist', async () => { | ||
const res = await commandExists(['notacommand', 'ssh']) | ||
expect(res).to.equal('ssh') | ||
}) | ||
|
||
it('should detect none of the commands exist', async () => { | ||
const res = await commandExists(['notacommand', 'alsonotacommand']) | ||
expect(res).to.equal(null) | ||
}) | ||
|
||
it('should detect the first command exists', async () => { | ||
const res = await commandExists(['ssh', 'ln']) | ||
expect(res).to.equal('ssh') | ||
}) | ||
}) | ||
}) |