Skip to content

Commit

Permalink
Update test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
khattori committed Oct 26, 2024
1 parent 7fc196e commit 3161003
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 24 deletions.
25 changes: 19 additions & 6 deletions test/commands/mkdir.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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')
})
})
20 changes: 14 additions & 6 deletions test/commands/put.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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')
})
})
20 changes: 14 additions & 6 deletions test/commands/rm.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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')
})
})
20 changes: 14 additions & 6 deletions test/commands/rmdir.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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')
})
})

0 comments on commit 3161003

Please sign in to comment.