-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.test.js
48 lines (42 loc) · 1.23 KB
/
index.test.js
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
45
46
47
48
/* global test, expect */
const promptmaker = require('.')
test('generates a prompt string', () => {
const prompt = promptmaker()
expect(typeof prompt).toBe('string')
})
test('takes an optional subject', () => {
const prompt = promptmaker({ subject: 'cheese' })
expect(typeof prompt).toBe('string')
expect(prompt).toMatch(/cheese/)
})
test('allows artist to be disabled', () => {
const prompt = promptmaker({ subject: 'untitled', artist: false })
expect(typeof prompt).toBe('string')
console.log(prompt)
expect(prompt).not.toContain(' by ')
})
test('takes lots of options', () => {
const prompt = promptmaker({
medium: 'oil painting',
subject: 'cheese',
movement: 'american impressionism',
artist: 'Anna Hotchkis'
})
expect(typeof prompt).toBe('string')
expect(prompt).toMatch(
'oil painting of cheese american impressionism by Anna Hotchkis, '
)
})
test('allows flavors to be disabled', () => {
const prompt = promptmaker({
medium: 'oil painting',
subject: 'cheese',
movement: 'american impressionism',
artist: 'Anna Hotchkis',
flavors: false
})
expect(typeof prompt).toBe('string')
expect(prompt).toBe(
'oil painting of cheese american impressionism by Anna Hotchkis'
)
})