/
format-topics.test.ts
37 lines (32 loc) · 1.05 KB
/
format-topics.test.ts
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
import {expect, test as base} from '@oclif/test'
import {TestHelp, topicsHelp} from './help-test-utils'
const g: any = global
g.oclif.columns = 80
const test = base
.loadConfig()
.add('help', ctx => new TestHelp(ctx.config as any))
.register('topicsHelp', topicsHelp)
describe('formatTopics', () => {
test
.topicsHelp([{
name: 'topic',
description: 'this is a description of my topic',
}])
.it('shows ouputs a single topic in the list', ctx => expect(ctx.commandHelp).to.equal(`TOPICS
topic this is a description of my topic`))
test
.topicsHelp([{
name: 'topic',
description: 'this is a description of my topic',
}, {
name: 'othertopic',
description: 'here we have a description for othertopic',
}, {
name: 'thirdtopic',
description: 'description for thirdtopic',
}])
.it('shows ouputs for multiple topics in the list', ctx => expect(ctx.commandHelp).to.equal(`TOPICS
topic this is a description of my topic
othertopic here we have a description for othertopic
thirdtopic description for thirdtopic`))
})