diff --git a/test/commands/mkdir.test.ts b/test/commands/mkdir.test.ts index be3ea60..6fd9215 100644 --- a/test/commands/mkdir.test.ts +++ b/test/commands/mkdir.test.ts @@ -2,13 +2,26 @@ import {runCommand} from '@oclif/test' import {expect} from 'chai' describe('mkdir', () => { - it('runs mkdir cmd', async () => { - const {stdout} = await runCommand('mkdir') - expect(stdout).to.contain('hello world') + before(async () => { + await runCommand('rm testdir --cwd /root -rfk') + await runCommand('mkdir testdir --cwd /root -k') + }) + after(async () => { + await runCommand('rm testdir --cwd /root -rfk') + }) + + it('runs mkdir', async () => { + const {error} = await runCommand('mkdir') + expect(error?.oclif?.exit).to.equal(2) + }) + + it('runs mkdir --help', async () => { + const {stdout} = await runCommand('mkdir --help') + expect(stdout).to.contain('USAGE') }) - it('runs mkdir --name oclif', async () => { - const {stdout} = await runCommand('mkdir --name oclif') - expect(stdout).to.contain('hello oclif') + it('runs mkdir somedir --cwd /root/testdir -kv', async() => { + const {stdout} = await runCommand('mkdir somedir --cwd /root/testdir -kv') + expect(stdout).to.contain('created directory: /root/testdir/somedir') }) }) diff --git a/test/commands/put.test.ts b/test/commands/put.test.ts index 665851d..7d382ac 100644 --- a/test/commands/put.test.ts +++ b/test/commands/put.test.ts @@ -2,13 +2,21 @@ import {runCommand} from '@oclif/test' import {expect} from 'chai' describe('put', () => { - it('runs put cmd', async () => { - const {stdout} = await runCommand('put') - expect(stdout).to.contain('hello world') + before(async () => { + await runCommand('rm testdir --cwd /root -rfk') + await runCommand('mkdir testdir --cwd /root -k') + }) + after(async () => { + await runCommand('rm testdir --cwd /root -rfk') + }) + + it('runs put', async () => { + const {error} = await runCommand('put') + expect(error?.oclif?.exit).to.equal(2) }) - it('runs put --name oclif', async () => { - const {stdout} = await runCommand('put --name oclif') - expect(stdout).to.contain('hello oclif') + it('runs put --help', async () => { + const {stdout} = await runCommand('put --help') + expect(stdout).to.contain('USAGE') }) }) diff --git a/test/commands/rm.test.ts b/test/commands/rm.test.ts index 087458f..22184f9 100644 --- a/test/commands/rm.test.ts +++ b/test/commands/rm.test.ts @@ -2,13 +2,21 @@ import {runCommand} from '@oclif/test' import {expect} from 'chai' describe('rm', () => { - it('runs rm cmd', async () => { - const {stdout} = await runCommand('rm') - expect(stdout).to.contain('hello world') + before(async () => { + await runCommand('rm testdir --cwd /root -rfk') + await runCommand('mkdir testdir --cwd /root -k') + }) + after(async () => { + await runCommand('rm testdir --cwd /root -rfk') + }) + + it('runs rm', async () => { + const {error} = await runCommand('rm') + expect(error?.oclif?.exit).to.equal(2) }) - it('runs rm --name oclif', async () => { - const {stdout} = await runCommand('rm --name oclif') - expect(stdout).to.contain('hello oclif') + it('runs rm --help oclif', async () => { + const {stdout} = await runCommand('rm --help') + expect(stdout).to.contain('USAGE') }) }) diff --git a/test/commands/rmdir.test.ts b/test/commands/rmdir.test.ts index 6a804b8..5ad2e44 100644 --- a/test/commands/rmdir.test.ts +++ b/test/commands/rmdir.test.ts @@ -2,13 +2,21 @@ import {runCommand} from '@oclif/test' import {expect} from 'chai' describe('rmdir', () => { - it('runs rmdir cmd', async () => { - const {stdout} = await runCommand('rmdir') - expect(stdout).to.contain('hello world') + before(async () => { + await runCommand('rm testdir --cwd /root -rfk') + await runCommand('mkdir testdir --cwd /root -k') + }) + after(async () => { + await runCommand('rm testdir --cwd /root -rfk') + }) + + it('runs rmdir', async () => { + const {error} = await runCommand('rmdir') + expect(error?.oclif?.exit).to.equal(2) }) - it('runs rmdir --name oclif', async () => { - const {stdout} = await runCommand('rmdir --name oclif') - expect(stdout).to.contain('hello oclif') + it('runs rmdir --help', async () => { + const {stdout} = await runCommand('rmdir --help') + expect(stdout).to.contain('USAGE') }) })