frequi_origin/src/components/general/ProfitPill.cy.ts

65 lines
2.0 KiB
TypeScript
Raw Normal View History

2022-05-11 05:58:24 +00:00
import ProfitPill from './ProfitPill.vue';
2021-12-17 18:40:15 +00:00
describe('ProfitPill.vue', () => {
2022-05-11 05:58:24 +00:00
it('Shows a Green pill with positive profits', () => {
2022-06-08 18:49:19 +00:00
cy.mount(ProfitPill, {
2021-12-17 18:40:15 +00:00
propsData: {
profitRatio: 0.051,
profitAbs: 0.1,
profitDesc: '',
stakeCurrency: 'USDT',
},
});
cy.get('div').should('have.class', 'profit-pill-profit').should('be.visible');
cy.get('div').should('contain', '5.10%');
cy.get('div').should('contain', '(0.1)');
cy.get('span').should('have.attr', 'title', 'USDT');
});
2022-05-11 05:58:24 +00:00
it('Shows a Red pill with positive profits', () => {
2022-06-08 18:49:19 +00:00
cy.mount(ProfitPill, {
2021-12-17 18:40:15 +00:00
propsData: {
profitRatio: -0.1,
profitAbs: -0.1,
profitDesc: '',
stakeCurrency: 'USDT',
},
});
cy.get('div').should('not.have.class', 'profit-pill-profit').should('be.visible');
cy.get('div').should('have.class', 'profit-pill').should('be.visible');
cy.get('div').should('contain', '-10.00%');
cy.get('div').should('contain', '(-0.1)');
cy.get('span').should('have.attr', 'title', 'USDT');
});
2022-05-11 05:58:24 +00:00
it('Shows a pill with 0.0 profits.', () => {
2022-06-08 18:49:19 +00:00
cy.mount(ProfitPill, {
2021-12-17 18:40:15 +00:00
propsData: {
profitRatio: 0.0,
profitAbs: 0.0,
profitDesc: '',
stakeCurrency: 'BTC',
},
});
cy.get('div').should('have.class', 'profit-pill').should('be.visible');
cy.get('div').should('contain', '0.00%');
cy.get('div').should('contain', '(0)');
cy.get('span').should('have.attr', 'title', 'BTC');
});
2022-05-11 05:58:24 +00:00
it('Shows a pill without relative profits.', () => {
2022-06-08 18:49:19 +00:00
cy.mount(ProfitPill, {
2022-05-09 05:10:34 +00:00
propsData: {
profitRatio: undefined,
profitAbs: 223,
profitDesc: '',
stakeCurrency: 'USDT',
},
});
cy.get('div').should('have.class', 'profit-pill').should('be.visible');
// cy.get('div').should('not.contain', '%');
cy.get('div').should('contain', '223');
cy.get('span').should('have.attr', 'title', 'USDT');
});
2021-12-17 18:40:15 +00:00
});