mirror of
https://github.com/freqtrade/frequi.git
synced 2024-11-10 10:21:55 +00:00
commit
377b6ddc6c
|
@ -27,15 +27,16 @@
|
|||
"extensions": [
|
||||
"vue.volar",
|
||||
"dbaeumer.vscode-eslint",
|
||||
"antfu.iconify",
|
||||
"ms-playwright.playwright",
|
||||
"vitest.explorer",
|
||||
"yzhang.markdown-all-in-one",
|
||||
"marquesmps.dockerfile-validator",
|
||||
"streetsidesoftware.code-spell-checker",
|
||||
"vscode-icons-team.vscode-icons",
|
||||
"hediet.vscode-drawio",
|
||||
"ZixuanChen.vitest-explorer",
|
||||
"antfu.iconify"
|
||||
"hediet.vscode-drawio"
|
||||
]
|
||||
}
|
||||
},
|
||||
"postCreateCommand": "yarn install",
|
||||
"postCreateCommand": "yarn install"
|
||||
}
|
||||
|
|
8
.github/workflows/ci.yml
vendored
8
.github/workflows/ci.yml
vendored
|
@ -57,14 +57,6 @@ jobs:
|
|||
|
||||
# End Playwright section
|
||||
|
||||
- name: Run Component tests
|
||||
uses: cypress-io/github-action@v6
|
||||
with:
|
||||
# we have already installed everything
|
||||
install: false
|
||||
# to run component tests we need to use "cypress run-ct"
|
||||
command: yarn cypress run --component
|
||||
|
||||
- name: Cypress run
|
||||
uses: cypress-io/github-action@v6
|
||||
with:
|
||||
|
|
3
.vscode/extensions.json
vendored
Normal file
3
.vscode/extensions.json
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"recommendations": ["Vue.volar", "dbaeumer.vscode-eslint", "antfu.iconify", "ms-playwright.playwright", "vitest.explorer"]
|
||||
}
|
|
@ -63,6 +63,7 @@
|
|||
"eslint": "^8.57.0",
|
||||
"eslint-plugin-prettier": "^5.1.3",
|
||||
"eslint-plugin-vue": "^9.24.1",
|
||||
"happy-dom": "^14.7.1",
|
||||
"mutationobserver-shim": "^0.3.7",
|
||||
"portal-vue": "^3.0.0",
|
||||
"prettier": "^3.2.5",
|
||||
|
|
|
@ -1,64 +0,0 @@
|
|||
import ProfitPill from './ProfitPill.vue';
|
||||
|
||||
describe('ProfitPill.vue', () => {
|
||||
it('Shows a Green pill with positive profits', () => {
|
||||
cy.mount(ProfitPill, {
|
||||
props: {
|
||||
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');
|
||||
});
|
||||
it('Shows a Red pill with positive profits', () => {
|
||||
cy.mount(ProfitPill, {
|
||||
props: {
|
||||
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');
|
||||
});
|
||||
it('Shows a pill with 0.0 profits.', () => {
|
||||
cy.mount(ProfitPill, {
|
||||
props: {
|
||||
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');
|
||||
});
|
||||
it('Shows a pill without relative profits.', () => {
|
||||
cy.mount(ProfitPill, {
|
||||
props: {
|
||||
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');
|
||||
});
|
||||
});
|
|
@ -1,15 +0,0 @@
|
|||
import ProfitSymbol from '@/components/general/ProfitSymbol.vue';
|
||||
|
||||
describe('ProfitSymbol.vue', () => {
|
||||
it('calculates isProfitable with negative profit', () => {
|
||||
cy.mount(ProfitSymbol, { props: { profit: -0.5 } });
|
||||
|
||||
cy.get('div').should('have.class', 'triangle-down');
|
||||
cy.get('div').should('not.have.class', 'triangle-up');
|
||||
});
|
||||
it('calculates isProfitable with positive profit', () => {
|
||||
cy.mount(ProfitSymbol, { props: { profit: 0.5 } });
|
||||
cy.get('div').should('have.class', 'triangle-up');
|
||||
cy.get('div').should('not.have.class', 'triangle-down');
|
||||
});
|
||||
});
|
|
@ -1,12 +0,0 @@
|
|||
import ValuePair from '@/components/general/ValuePair.vue';
|
||||
|
||||
describe('ValuePair.vue', () => {
|
||||
it('Renders a message', () => {
|
||||
const msg = 'Test description';
|
||||
// https://github.com/cypress-io/cypress/issues/26628
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-expect-error
|
||||
cy.mount(ValuePair, { props: { description: msg } });
|
||||
cy.get('label').contains(msg);
|
||||
});
|
||||
});
|
66
tests/component/ProfitPill.spec.ts
Normal file
66
tests/component/ProfitPill.spec.ts
Normal file
|
@ -0,0 +1,66 @@
|
|||
import ProfitPill from '@/components/general/ProfitPill.vue';
|
||||
import { mount } from '@vue/test-utils';
|
||||
import { describe, expect, it } from 'vitest';
|
||||
|
||||
describe('ProfitPill.vue', () => {
|
||||
it('Shows a Green pill with positive profits', () => {
|
||||
const wrapper = mount(ProfitPill, {
|
||||
props: {
|
||||
profitRatio: 0.051,
|
||||
profitAbs: 0.1,
|
||||
profitDesc: '',
|
||||
stakeCurrency: 'USDT',
|
||||
},
|
||||
});
|
||||
expect(wrapper.find('div').classes()).toContain('profit-pill-profit');
|
||||
expect(wrapper.find('div').text()).toContain('5.10%');
|
||||
expect(wrapper.find('div').text()).toContain('(0.1)');
|
||||
expect(wrapper.find('span').element.title).toBe('USDT');
|
||||
});
|
||||
it('Shows a Red pill with positive profits', () => {
|
||||
const wrapper = mount(ProfitPill, {
|
||||
props: {
|
||||
profitRatio: -0.1,
|
||||
profitAbs: -0.1,
|
||||
profitDesc: '',
|
||||
stakeCurrency: 'USDT',
|
||||
},
|
||||
});
|
||||
|
||||
expect(wrapper.get('div').classes()).not.toContain('profit-pill-profit');
|
||||
expect(wrapper.get('div').classes()).toContain('profit-pill');
|
||||
expect(wrapper.get('div').text()).toContain('-10.00%');
|
||||
expect(wrapper.get('div').text()).toContain('(-0.1)');
|
||||
expect(wrapper.get('span').element.title).toBe('USDT');
|
||||
});
|
||||
it('Shows a pill with 0.0 profits.', () => {
|
||||
const wrapper = mount(ProfitPill, {
|
||||
props: {
|
||||
profitRatio: 0.0,
|
||||
profitAbs: 0.0,
|
||||
profitDesc: '',
|
||||
stakeCurrency: 'BTC',
|
||||
},
|
||||
});
|
||||
|
||||
expect(wrapper.get('div').classes()).toContain('profit-pill');
|
||||
expect(wrapper.get('div').text()).toContain('0.00%');
|
||||
expect(wrapper.get('div').text()).toContain('(0)');
|
||||
expect(wrapper.get('span').element.title).toBe('BTC');
|
||||
});
|
||||
it('Shows a pill without relative profits.', () => {
|
||||
const wrapper = mount(ProfitPill, {
|
||||
props: {
|
||||
profitRatio: undefined,
|
||||
profitAbs: 223,
|
||||
profitDesc: '',
|
||||
stakeCurrency: 'USDT',
|
||||
},
|
||||
});
|
||||
|
||||
expect(wrapper.get('div').classes()).toContain('profit-pill');
|
||||
expect(wrapper.get('div').text()).not.toContain('%');
|
||||
expect(wrapper.get('div').text()).toContain('223');
|
||||
expect(wrapper.get('span').element.title).toBe('USDT');
|
||||
});
|
||||
});
|
20
tests/component/ProfitSymbol.spec.ts
Normal file
20
tests/component/ProfitSymbol.spec.ts
Normal file
|
@ -0,0 +1,20 @@
|
|||
import ProfitSymbol from '@/components/general/ProfitSymbol.vue';
|
||||
import { mount } from '@vue/test-utils';
|
||||
import { describe, expect, it } from 'vitest';
|
||||
|
||||
describe('ProfitSymbol.vue', () => {
|
||||
it('calculates isProfitable with negative profit', () => {
|
||||
const wrapper = mount(ProfitSymbol, { props: { profit: -0.5 } });
|
||||
const divs = wrapper.findAll('div');
|
||||
expect(divs[1].classes()).toContain('triangle-down');
|
||||
expect(divs[1].classes()).not.toContain('triangle-up');
|
||||
});
|
||||
|
||||
it('calculates isProfitable with positive profit', () => {
|
||||
const wrapper = mount(ProfitSymbol, { props: { profit: 0.5 } });
|
||||
|
||||
const divs = wrapper.findAll('div');
|
||||
expect(divs[1].classes()).not.toContain('triangle-down');
|
||||
expect(divs[1].classes()).toContain('triangle-up');
|
||||
});
|
||||
});
|
11
tests/component/VaulePair.spec.ts
Normal file
11
tests/component/VaulePair.spec.ts
Normal file
|
@ -0,0 +1,11 @@
|
|||
import ValuePair from '@/components/general/ValuePair.vue';
|
||||
import { mount } from '@vue/test-utils';
|
||||
import { describe, expect, it } from 'vitest';
|
||||
|
||||
describe('ValuePair.vue', () => {
|
||||
it('Renders a message', async () => {
|
||||
const msg = 'Test description';
|
||||
const wrapper = mount(ValuePair, { props: { description: msg } });
|
||||
expect(wrapper.find('label').text()).toContain(msg);
|
||||
});
|
||||
});
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"extends": "../tsconfig.json",
|
||||
"include": [
|
||||
"unit/*.ts",
|
||||
"unit/*.tsx"
|
||||
"**/*.ts",
|
||||
"**/*.tsx"
|
||||
],
|
||||
}
|
||||
|
|
|
@ -64,6 +64,7 @@ export default defineConfig({
|
|||
port: 3000,
|
||||
},
|
||||
test: {
|
||||
environment: 'happy-dom',
|
||||
exclude: [
|
||||
'**/node_modules/**',
|
||||
'**/dist/**',
|
26
yarn.lock
26
yarn.lock
|
@ -3210,6 +3210,7 @@ __metadata:
|
|||
eslint-plugin-prettier: "npm:^5.1.3"
|
||||
eslint-plugin-vue: "npm:^9.24.1"
|
||||
favico.js: "npm:^0.3.10"
|
||||
happy-dom: "npm:^14.7.1"
|
||||
humanize-duration: "npm:^3.32.0"
|
||||
mutationobserver-shim: "npm:^0.3.7"
|
||||
pinia: "npm:^2.1.7"
|
||||
|
@ -3479,6 +3480,17 @@ __metadata:
|
|||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"happy-dom@npm:^14.7.1":
|
||||
version: 14.7.1
|
||||
resolution: "happy-dom@npm:14.7.1"
|
||||
dependencies:
|
||||
entities: "npm:^4.5.0"
|
||||
webidl-conversions: "npm:^7.0.0"
|
||||
whatwg-mimetype: "npm:^3.0.0"
|
||||
checksum: 10/8a8c8995abc92d5319750d71cac08a4aafd26e8a7203d2a970270c5c1ca68dad2b3af772de761e061107f3aaa51d6cb9430f07e05366047a126ef908377a4c08
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"has-flag@npm:^4.0.0":
|
||||
version: 4.0.0
|
||||
resolution: "has-flag@npm:4.0.0"
|
||||
|
@ -6140,6 +6152,13 @@ __metadata:
|
|||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"webidl-conversions@npm:^7.0.0":
|
||||
version: 7.0.0
|
||||
resolution: "webidl-conversions@npm:7.0.0"
|
||||
checksum: 10/4c4f65472c010eddbe648c11b977d048dd96956a625f7f8b9d64e1b30c3c1f23ea1acfd654648426ce5c743c2108a5a757c0592f02902cf7367adb7d14e67721
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"webpack-sources@npm:^3.2.3":
|
||||
version: 3.2.3
|
||||
resolution: "webpack-sources@npm:3.2.3"
|
||||
|
@ -6154,6 +6173,13 @@ __metadata:
|
|||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"whatwg-mimetype@npm:^3.0.0":
|
||||
version: 3.0.0
|
||||
resolution: "whatwg-mimetype@npm:3.0.0"
|
||||
checksum: 10/96f9f628c663c2ae05412c185ca81b3df54bcb921ab52fe9ebc0081c1720f25d770665401eb2338ab7f48c71568133845638e18a81ed52ab5d4dcef7d22b40ef
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"which@npm:^2.0.1":
|
||||
version: 2.0.2
|
||||
resolution: "which@npm:2.0.2"
|
||||
|
|
Loading…
Reference in New Issue
Block a user