-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathbooleans.js
37 lines (34 loc) · 1.49 KB
/
booleans.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
import inspect from '../lib/index.js'
import { expect } from 'chai'
describe('booleans', () => {
it('returns `false` for false', () => {
expect(inspect(false)).to.equal('false')
expect(inspect(true)).to.equal('true')
expect(inspect(new Boolean(1))).to.equal('true')
expect(inspect(new Boolean(false))).to.equal('false')
})
it('returns `true` for true', () => {
expect(inspect(false)).to.equal('false')
expect(inspect(true)).to.equal('true')
})
describe('colors', () => {
it('returns string with yellow color, if colour is set to true', () => {
expect(inspect(false, { colors: true })).to.equal('\u001b[33mfalse\u001b[39m')
expect(inspect(true, { colors: true })).to.equal('\u001b[33mtrue\u001b[39m')
})
})
describe('truncated', () => {
it('returns the full string representation regardless of truncate', () => {
expect(inspect(true, { truncate: 5 })).to.equal('true')
expect(inspect(true, { truncate: 4 })).to.equal('true')
expect(inspect(true, { truncate: 3 })).to.equal('true')
expect(inspect(true, { truncate: 2 })).to.equal('true')
expect(inspect(true, { truncate: 1 })).to.equal('true')
expect(inspect(false, { truncate: 5 })).to.equal('false')
expect(inspect(false, { truncate: 4 })).to.equal('false')
expect(inspect(false, { truncate: 3 })).to.equal('false')
expect(inspect(false, { truncate: 2 })).to.equal('false')
expect(inspect(false, { truncate: 1 })).to.equal('false')
})
})
})