How can I test this case?
I have a variable in the setup:
setup() {
const address = `${process.env.VAR_ENV}`
onMounted(async () => {
const stop = await isContinuing(address)
The function await isContinuing(address) is executing when the test is run. How can I make the function not run when the test is ran?
My test's undefined wrap variable
beforeEach(() => {
wrapper = shallowMount(App, {
})
})
describe('Dashboard', () => {
it('test to verify if initial section.', () => {
const expected = 0
expect(wrapper.findComponent({ ref: 'section' }).element.value).toBe(
expected
)
})
Jest (and I assume most test frameworks) sets NODE_ENV enviromental variable to test. So you can use a simple if statement to not execute something in tests:
if(process.env.NODE_ENV !== 'test') {
const stop = await isContinuing(address)
}