![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/vreg/node_modules/bootstrap-vue/src/utils/ |
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}` ) }) }) })