4cd4fd28
郭伟龙
feat: 初始化项目
|
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
49
50
51
52
53
54
|
import { warn } from './warn'
describe('utils/warn', () => {
const dummyWarning = 'This is a dummy warning.'
const dummySource = 'DummyComponent'
let originalProcess
beforeAll(() => {
jest.spyOn(console, 'warn').mockImplementation(() => {})
originalProcess = global.process
})
afterEach(() => {
console.warn.mockClear()
global.process = originalProcess
})
describe('with "BOOTSTRAP_VUE_NO_WARN" environment variable set', () => {
beforeEach(() => {
global.process = {
env: {
BOOTSTRAP_VUE_NO_WARN: true
}
}
})
it('does not call "console.warn()"', () => {
warn(dummyWarning)
expect(console.warn).not.toHaveBeenCalled()
})
})
describe('without process object', () => {
beforeEach(() => {
delete global.process
})
it('calls "console.warn()" with warning', () => {
warn(dummyWarning)
expect(console.warn).toHaveBeenCalledWith(`[BootstrapVue warn]: ${dummyWarning}`)
})
it('calls "console.warn()" with warning and source', () => {
warn(dummyWarning, dummySource)
expect(console.warn).toHaveBeenCalledWith(
`[BootstrapVue warn]: ${dummySource} - ${dummyWarning}`
)
})
})
})
|