Add vue.nextTick to profitSymbol tests

This commit is contained in:
Matthias 2021-02-08 10:52:12 +01:00
parent ea918024fa
commit 86f0002263

View File

@ -9,22 +9,20 @@ describe('ProfitSymbol.vue', () => {
beforeEach(() => { beforeEach(() => {
cmp = mount(ProfitSymbol, { propsData: { trade: {} } }); cmp = mount(ProfitSymbol, { propsData: { trade: {} } });
}); });
it('calculates isProfitable with negative profit', () => { it('calculates isProfitable with negative profit', async () => {
const trade = { const trade = {
profit_ratio: -0.5, profit_ratio: -0.5,
}; };
cmp.setProps({ trade }); cmp.setProps({ trade });
await Vue.nextTick();
expect(cmp.vm.isProfitable).toBe(false); expect(cmp.vm.isProfitable).toBe(false);
}); });
it('calculates isProfitable with positive profit', () => { it('calculates isProfitable with positive profit', async () => {
const trade = { const trade = {
close_profit: 0.5,
current_profit: 0.5,
profit_ratio: 0.5, profit_ratio: 0.5,
}; };
cmp.setProps({ trade }); cmp.setProps({ trade });
await Vue.nextTick();
expect(cmp.vm.isProfitable).toBe(true); expect(cmp.vm.isProfitable).toBe(true);
}); });