Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: change how we assert inspection #12

Merged
merged 1 commit into from
Jan 14, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,33 +50,33 @@ describe('plugin-inspect', function () {

it('works for strings', function () {
var ret = shell.cat('index.js');
ret[inspectAttribute]().should.equal(fs.readFileSync('index.js', 'utf-8'));
util.inspect(ret).should.equal(fs.readFileSync('index.js', 'utf-8'));
});

it.skip('works for commands with no trailing newline', function () {
var ret = shell.pwd();
ret[inspectAttribute]().should.equal(process.cwd() + '\n');
util.inspect(ret).should.equal(process.cwd() + '\n');
});

it('works for arrays', function () {
var ret = shell.cat('index.js');
ret[inspectAttribute]().should.equal(fs.readFileSync('index.js', 'utf-8'));
util.inspect(ret).should.equal(fs.readFileSync('index.js', 'utf-8'));
});

it('gets applied directly to ShellStrings', function () {
var ret = new shell.ShellString('Hello world');
ret[inspectAttribute]().should.be.type('string');
ret[inspectAttribute]().should.equal('Hello world');
util.inspect(ret).should.be.type('string');
util.inspect(ret).should.equal('Hello world');
});

it('works for piped commands', function () {
var ret = shell.cat('index.js').grep('o');
ret[inspectAttribute]().should.equal(shell.grep('o', 'index.js').toString());
util.inspect(ret).should.equal(shell.grep('o', 'index.js').toString());
});

it('works for commands that have errors', function () {
var ret = shell.rm('fakeFileName.txt');
ret[inspectAttribute]().should.equal('');
util.inspect(ret).should.equal('');
});

it('does not break non-ShellString commands', function () {
Expand Down