-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.test.ts
More file actions
44 lines (38 loc) · 1.44 KB
/
index.test.ts
File metadata and controls
44 lines (38 loc) · 1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import { describe, test, expect } from 'bun:test'
import { $ } from 'bun'
import pkg from './package.json'
describe('CLI integration', () => {
test('--help shows usage', async () => {
const result = await $`bun index.ts --help`.quiet()
const stdout = result.stdout.toString()
expect(stdout).toContain('stackboi')
expect(stdout).toContain('init')
expect(stdout).toContain('new')
expect(stdout).toContain('add')
expect(stdout).toContain('view')
expect(stdout).toContain('pr')
})
test('--version shows version', async () => {
const result = await $`bun index.ts --version`.quiet()
expect(result.stdout.toString()).toContain(pkg.version)
})
test('new --help shows branch argument', async () => {
const result = await $`bun index.ts new --help`.quiet()
const stdout = result.stdout.toString()
expect(stdout).toContain('branch')
})
test('add --help shows branch argument', async () => {
const result = await $`bun index.ts add --help`.quiet()
const stdout = result.stdout.toString()
expect(stdout).toContain('branch')
})
test('pr --help shows branch argument', async () => {
const result = await $`bun index.ts pr --help`.quiet()
const stdout = result.stdout.toString()
expect(stdout).toContain('branch')
})
test('unknown command shows error', async () => {
const result = await $`bun index.ts unknown`.quiet().nothrow()
expect(result.exitCode).not.toBe(0)
})
})