chore: add build-spec targets and execute on affected apps and libs on CI (#1745)

* chore: add build-spec targets and execute on affected apps and libs on CI

* chore: fix market-depth and react-helpers specs typings

* chore: fix ui-toolkit specs typings

* chore: fix trades specs typings

* chore: fix orders specs typings

* chore: fix deposits specs typings

* chore: fix deal-ticket specs typings

* feat: fix tsc on specs check

* feat: fix tsc on specs check

* feat: fix tsc on specs check

* feat: fix tsc on specs check

* feat: fix tsc on specs check - fix token app

* feat: fix tsc on specs check - fix positions lib

* feat: fix tsc on specs check - fix environment lib

* chore: fix failling build-spec in positions lib

Co-authored-by: maciek <maciek@vegaprotocol.io>
This commit is contained in:
Bartłomiej Głownia 2022-10-25 09:41:16 +02:00 committed by GitHub
parent fcd99722b9
commit 17f93c2b7e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
55 changed files with 295 additions and 66 deletions

View File

@ -42,3 +42,5 @@ jobs:
run: yarn nx affected:test run: yarn nx affected:test
- name: Build affected - name: Build affected
run: yarn nx affected:build run: yarn nx affected:build
- name: Build affected spec
run: yarn nx affected --target=build-spec

View File

@ -77,6 +77,13 @@
"nx build console-lite" "nx build console-lite"
] ]
} }
},
"build-spec": {
"executor": "@nrwl/workspace:run-commands",
"outputs": [],
"options": {
"command": "yarn tsc --project ./apps/console-lite/tsconfig.spec.json"
}
} }
}, },
"tags": [] "tags": []

View File

@ -1,21 +1,22 @@
import React from 'react'; import React from 'react';
import { render } from '@testing-library/react'; import { render } from '@testing-library/react';
import type { import type {
PartyBalanceQuery_party_accounts, AccountFragment,
PartyBalanceQuery_party_accounts_asset, DealTicketMarketFragment,
} from './__generated__/PartyBalanceQuery'; } from '@vegaprotocol/deal-ticket';
import { DealTicketBalance } from './deal-ticket-balance'; import { DealTicketBalance } from './deal-ticket-balance';
import { AccountType } from '@vegaprotocol/types'; import { AccountType } from '@vegaprotocol/types';
const tDAI: PartyBalanceQuery_party_accounts_asset = { const tDAI: DealTicketMarketFragment['tradableInstrument']['instrument']['product']['settlementAsset'] =
__typename: 'Asset', {
id: '1', __typename: 'Asset',
symbol: 'tDAI', id: '1',
name: 'TDAI', symbol: 'tDAI',
decimals: 2, name: 'TDAI',
}; decimals: 2,
};
const accounts: PartyBalanceQuery_party_accounts[] = [ const accounts: AccountFragment[] = [
{ {
__typename: 'Account', __typename: 'Account',
type: AccountType.ACCOUNT_TYPE_GENERAL, type: AccountType.ACCOUNT_TYPE_GENERAL,

View File

@ -15,8 +15,8 @@ import {
} from '@testing-library/react'; } from '@testing-library/react';
import { MockedProvider } from '@apollo/react-testing'; import { MockedProvider } from '@apollo/react-testing';
import { MarketState } from '@vegaprotocol/types'; import { MarketState } from '@vegaprotocol/types';
import type { Market } from '@vegaprotocol/market-list';
import SimpleMarketToolbar from './simple-market-toolbar'; import SimpleMarketToolbar from './simple-market-toolbar';
import type { SimpleMarkets_markets } from './__generated__/SimpleMarkets';
import { markets as filterData } from './mocks/market-filters.json'; import { markets as filterData } from './mocks/market-filters.json';
const mockedNavigate = jest.fn(); const mockedNavigate = jest.fn();
@ -35,35 +35,23 @@ describe('SimpleMarketToolbar', () => {
const routes = useRoutes([ const routes = useRoutes([
{ {
path: '/', path: '/',
element: ( element: <SimpleMarketToolbar data={filterData as Market[]} />,
<SimpleMarketToolbar data={filterData as SimpleMarkets_markets[]} />
),
}, },
{ {
path: 'markets', path: 'markets',
children: [ children: [
{ {
path: `:state`, path: `:state`,
element: ( element: <SimpleMarketToolbar data={filterData as Market[]} />,
<SimpleMarketToolbar
data={filterData as SimpleMarkets_markets[]}
/>
),
children: [ children: [
{ {
path: `:product`, path: `:product`,
element: ( element: <SimpleMarketToolbar data={filterData as Market[]} />,
<SimpleMarketToolbar
data={filterData as SimpleMarkets_markets[]}
/>
),
children: [ children: [
{ {
path: `:asset`, path: `:asset`,
element: ( element: (
<SimpleMarketToolbar <SimpleMarketToolbar data={filterData as Market[]} />
data={filterData as SimpleMarkets_markets[]}
/>
), ),
}, },
], ],
@ -71,9 +59,7 @@ describe('SimpleMarketToolbar', () => {
], ],
}, },
], ],
element: ( element: <SimpleMarketToolbar data={filterData as Market[]} />,
<SimpleMarketToolbar data={filterData as SimpleMarkets_markets[]} />
),
}, },
]); ]);
const location = useLocation(); const location = useLocation();
@ -166,7 +152,7 @@ describe('SimpleMarketToolbar', () => {
})); }));
render( render(
<MockedProvider mocks={[]} addTypename={false}> <MockedProvider mocks={[]} addTypename={false}>
<SimpleMarketToolbar data={filterData as SimpleMarkets_markets[]} /> <SimpleMarketToolbar data={filterData as Market[]} />
</MockedProvider>, </MockedProvider>,
{ wrapper: BrowserRouter } { wrapper: BrowserRouter }
); );
@ -187,7 +173,7 @@ describe('SimpleMarketToolbar', () => {
(useParams as jest.Mock).mockImplementation(() => ({})); (useParams as jest.Mock).mockImplementation(() => ({}));
render( render(
<MockedProvider mocks={[]} addTypename={false}> <MockedProvider mocks={[]} addTypename={false}>
<SimpleMarketToolbar data={filterData as SimpleMarkets_markets[]} /> <SimpleMarketToolbar data={filterData as Market[]} />
</MockedProvider>, </MockedProvider>,
{ wrapper: BrowserRouter } { wrapper: BrowserRouter }
); );
@ -211,7 +197,7 @@ describe('SimpleMarketToolbar', () => {
})); }));
render( render(
<MockedProvider mocks={[]} addTypename={false}> <MockedProvider mocks={[]} addTypename={false}>
<SimpleMarketToolbar data={filterData as SimpleMarkets_markets[]} /> <SimpleMarketToolbar data={filterData as Market[]} />
</MockedProvider>, </MockedProvider>,
{ wrapper: BrowserRouter } { wrapper: BrowserRouter }
); );

View File

@ -3,11 +3,9 @@
"compilerOptions": { "compilerOptions": {
"outDir": "../../dist/out-tsc", "outDir": "../../dist/out-tsc",
"module": "commonjs", "module": "commonjs",
"types": ["jest", "node", "@testing-library/jest-dom"], "types": ["jest", "node", "@testing-library/jest-dom"]
"jsx": "react",
"allowSyntheticDefaultImports": true,
"esModuleInterop": true
}, },
"files": ["../../node_modules/@nrwl/react/typings/cssmodule.d.ts"],
"include": [ "include": [
"**/*.test.ts", "**/*.test.ts",
"**/*.spec.ts", "**/*.spec.ts",

View File

@ -74,6 +74,13 @@
"nx build explorer" "nx build explorer"
] ]
} }
},
"build-spec": {
"executor": "@nrwl/workspace:run-commands",
"outputs": [],
"options": {
"command": "yarn tsc --project ./apps/explorer/tsconfig.spec.json"
}
} }
}, },
"tags": [] "tags": []

View File

@ -88,6 +88,13 @@
"nx build liquidity-provision-dashboard" "nx build liquidity-provision-dashboard"
] ]
} }
},
"build-spec": {
"executor": "@nrwl/workspace:run-commands",
"outputs": [],
"options": {
"command": "yarn tsc --project ./apps/liquidity-provision-dashboard/tsconfig.spec.json"
}
} }
}, },
"tags": [] "tags": []

View File

@ -74,6 +74,13 @@
"nx build multisig-signer" "nx build multisig-signer"
] ]
} }
},
"build-spec": {
"executor": "@nrwl/workspace:run-commands",
"outputs": [],
"options": {
"command": "yarn tsc --project ./apps/multisig-signer/tsconfig.spec.json"
}
} }
}, },
"tags": [] "tags": []

View File

@ -64,6 +64,13 @@
"jestConfig": "apps/stats/jest.config.ts", "jestConfig": "apps/stats/jest.config.ts",
"passWithNoTests": true "passWithNoTests": true
} }
},
"build-spec": {
"executor": "@nrwl/workspace:run-commands",
"outputs": [],
"options": {
"command": "yarn tsc --project ./apps/stats/tsconfig.spec.json"
}
} }
}, },
"tags": [] "tags": []

View File

@ -74,6 +74,13 @@
"nx build token" "nx build token"
] ]
} }
},
"build-spec": {
"executor": "@nrwl/workspace:run-commands",
"outputs": [],
"options": {
"command": "yarn tsc --project ./apps/token/tsconfig.spec.json"
}
} }
}, },
"tags": [] "tags": []

View File

@ -1,6 +1,7 @@
import { render, screen } from '@testing-library/react'; import { render, screen } from '@testing-library/react';
import { generateProposal } from '../../test-helpers/generate-proposals'; import { generateProposal } from '../../test-helpers/generate-proposals';
import { Proposal } from './proposal'; import { Proposal } from './proposal';
import type { Proposal_proposal } from '../../proposal/__generated__/Proposal';
jest.mock('../proposal-detail-header/proposal-header', () => ({ jest.mock('../proposal-detail-header/proposal-header', () => ({
ProposalHeader: () => <div data-testid="proposal-header"></div>, ProposalHeader: () => <div data-testid="proposal-header"></div>,
@ -20,13 +21,13 @@ jest.mock('../vote-details', () => ({
it('Renders with data-testid', () => { it('Renders with data-testid', () => {
const proposal = generateProposal(); const proposal = generateProposal();
render(<Proposal proposal={proposal} />); render(<Proposal proposal={proposal as Proposal_proposal} />);
expect(screen.getByTestId('proposal')).toBeInTheDocument(); expect(screen.getByTestId('proposal')).toBeInTheDocument();
}); });
it('renders each section', () => { it('renders each section', () => {
const proposal = generateProposal(); const proposal = generateProposal();
render(<Proposal proposal={proposal} />); render(<Proposal proposal={proposal as Proposal_proposal} />);
expect(screen.getByTestId('proposal-header')).toBeInTheDocument(); expect(screen.getByTestId('proposal-header')).toBeInTheDocument();
expect(screen.getByTestId('proposal-change-table')).toBeInTheDocument(); expect(screen.getByTestId('proposal-change-table')).toBeInTheDocument();
expect(screen.getByTestId('proposal-terms-json')).toBeInTheDocument(); expect(screen.getByTestId('proposal-terms-json')).toBeInTheDocument();

View File

@ -14,7 +14,7 @@ import {
lastMonth, lastMonth,
nextMonth, nextMonth,
} from '../../test-helpers/mocks'; } from '../../test-helpers/mocks';
import type { ProposalsConnection_proposalsConnection_edges_node as ProposalNode } from '@vegaprotocol/governance'; import type { ProposalFields } from '../../__generated__/ProposalFields';
const openProposalClosesNextMonth = generateProposal({ const openProposalClosesNextMonth = generateProposal({
id: 'proposal1', id: 'proposal1',
@ -58,7 +58,7 @@ const failedProposalClosedLastMonth = generateProposal({
}, },
}); });
const renderComponent = (proposals: ProposalNode[]) => ( const renderComponent = (proposals: ProposalFields[]) => (
<Router> <Router>
<MockedProvider mocks={[networkParamsQueryMock]}> <MockedProvider mocks={[networkParamsQueryMock]}>
<AppStateProvider> <AppStateProvider>

View File

@ -12,7 +12,7 @@ import {
nextWeek, nextWeek,
lastMonth, lastMonth,
} from '../../test-helpers/mocks'; } from '../../test-helpers/mocks';
import type { ProposalsConnection_proposalsConnection_edges_node as ProposalNode } from '@vegaprotocol/governance'; import type { ProposalFields } from '../../__generated__/ProposalFields';
const rejectedProposalClosesNextWeek = generateProposal({ const rejectedProposalClosesNextWeek = generateProposal({
id: 'rejected1', id: 'rejected1',
@ -35,7 +35,7 @@ const rejectedProposalClosedLastMonth = generateProposal({
}, },
}); });
const renderComponent = (proposals: ProposalNode[]) => ( const renderComponent = (proposals: ProposalFields[]) => (
<Router> <Router>
<MockedProvider mocks={[networkParamsQueryMock]}> <MockedProvider mocks={[networkParamsQueryMock]}>
<AppStateProvider> <AppStateProvider>

View File

@ -50,7 +50,7 @@ describe('Proposal container', () => {
it('Renders proposal details if proposal is found', async () => { it('Renders proposal details if proposal is found', async () => {
const proposal = generateProposal({ id: 'foo' }); const proposal = generateProposal({ id: 'foo' });
render(renderComponent(proposal, 'foo')); render(renderComponent(proposal as Proposal_proposal, 'foo'));
await waitFor(() => { await waitFor(() => {
expect(screen.getByTestId('proposal')).toBeInTheDocument(); expect(screen.getByTestId('proposal')).toBeInTheDocument();
}); });

View File

@ -60,6 +60,13 @@
"nx build trading" "nx build trading"
] ]
} }
},
"build-spec": {
"executor": "@nrwl/workspace:run-commands",
"outputs": [],
"options": {
"command": "yarn tsc --project ./apps/trading/tsconfig.spec.json"
}
} }
}, },
"tags": [] "tags": []

View File

@ -1,10 +1,10 @@
{ {
"extends": "./tsconfig.json", "extends": "./tsconfig.json",
"compilerOptions": { "compilerOptions": {
"jsx": "react-jsx",
"outDir": "../../dist/out-tsc", "outDir": "../../dist/out-tsc",
"module": "commonjs", "module": "commonjs",
"types": ["jest", "node", "@testing-library/jest-dom"], "types": ["jest", "node", "@testing-library/jest-dom"]
"jsx": "react"
}, },
"include": [ "include": [
"**/*.test.ts", "**/*.test.ts",

View File

@ -69,6 +69,13 @@
"quiet": true "quiet": true
} }
} }
},
"build-spec": {
"executor": "@nrwl/workspace:run-commands",
"outputs": [],
"options": {
"command": "yarn tsc --project ./libs/accounts/tsconfig.spec.json"
}
} }
} }
} }

View File

@ -38,6 +38,13 @@
"jestConfig": "libs/assets/jest.config.ts", "jestConfig": "libs/assets/jest.config.ts",
"passWithNoTests": true "passWithNoTests": true
} }
},
"build-spec": {
"executor": "@nrwl/workspace:run-commands",
"outputs": [],
"options": {
"command": "yarn tsc --project ./libs/assets/tsconfig.spec.json"
}
} }
} }
} }

View File

@ -38,6 +38,13 @@
"jestConfig": "libs/candles-chart/jest.config.ts", "jestConfig": "libs/candles-chart/jest.config.ts",
"passWithNoTests": true "passWithNoTests": true
} }
},
"build-spec": {
"executor": "@nrwl/workspace:run-commands",
"outputs": [],
"options": {
"command": "yarn tsc --project ./libs/candles-chart/tsconfig.spec.json"
}
} }
} }
} }

View File

@ -17,6 +17,13 @@
"jestConfig": "libs/cypress/jest.config.ts", "jestConfig": "libs/cypress/jest.config.ts",
"passWithNoTests": true "passWithNoTests": true
} }
},
"build-spec": {
"executor": "@nrwl/workspace:run-commands",
"outputs": [],
"options": {
"command": "yarn tsc --project ./libs/cypress/tsconfig.spec.json"
}
} }
}, },
"tags": [] "tags": []

View File

@ -38,6 +38,13 @@
"jestConfig": "libs/deal-ticket/jest.config.ts", "jestConfig": "libs/deal-ticket/jest.config.ts",
"passWithNoTests": true "passWithNoTests": true
} }
},
"build-spec": {
"executor": "@nrwl/workspace:run-commands",
"outputs": [],
"options": {
"command": "yarn tsc --project ./libs/deal-ticket/tsconfig.spec.json"
}
} }
} }
} }

View File

@ -48,6 +48,15 @@ const market: DealTicketMarketFragment = {
price: '100', price: '100',
}, },
}, },
fees: {
__typename: 'Fees',
factors: {
__typename: 'FeeFactors',
makerFee: '1',
infrastructureFee: '2',
liquidityFee: '3',
},
},
}; };
const defaultWalletContext = { const defaultWalletContext = {

View File

@ -5,6 +5,7 @@
"module": "commonjs", "module": "commonjs",
"types": ["jest", "node", "@testing-library/jest-dom"] "types": ["jest", "node", "@testing-library/jest-dom"]
}, },
"files": ["../../node_modules/@nrwl/react/typings/cssmodule.d.ts"],
"include": [ "include": [
"**/*.test.ts", "**/*.test.ts",
"**/*.spec.ts", "**/*.spec.ts",

View File

@ -38,6 +38,13 @@
"jestConfig": "libs/deposits/jest.config.ts", "jestConfig": "libs/deposits/jest.config.ts",
"passWithNoTests": true "passWithNoTests": true
} }
},
"build-spec": {
"executor": "@nrwl/workspace:run-commands",
"outputs": [],
"options": {
"command": "yarn tsc --project ./libs/deposits/tsconfig.spec.json"
}
} }
} }
} }

View File

@ -2,28 +2,37 @@ import { waitFor, fireEvent, render, screen } from '@testing-library/react';
import BigNumber from 'bignumber.js'; import BigNumber from 'bignumber.js';
import type { DepositFormProps } from './deposit-form'; import type { DepositFormProps } from './deposit-form';
import { DepositForm } from './deposit-form'; import { DepositForm } from './deposit-form';
import { AssetStatus } from '@vegaprotocol/types';
import { useVegaWallet } from '@vegaprotocol/wallet'; import { useVegaWallet } from '@vegaprotocol/wallet';
import { useWeb3React } from '@web3-react/core'; import { useWeb3React } from '@web3-react/core';
import type { Asset } from '@vegaprotocol/react-helpers'; import type { AssetFieldsFragment } from '@vegaprotocol/assets';
jest.mock('@vegaprotocol/wallet'); jest.mock('@vegaprotocol/wallet');
jest.mock('@web3-react/core'); jest.mock('@web3-react/core');
function generateAsset(): Asset { function generateAsset(): AssetFieldsFragment {
return { return {
__typename: 'Asset', __typename: 'Asset',
id: 'asset-id', id: 'asset-id',
symbol: 'asset-symbol', symbol: 'asset-symbol',
name: 'asset-name', name: 'asset-name',
decimals: 2, decimals: 2,
quantum: '',
status: AssetStatus.STATUS_ENABLED,
source: { source: {
__typename: 'ERC20', __typename: 'ERC20',
contractAddress: 'contract-address', contractAddress: 'contract-address',
lifetimeLimit: '',
withdrawThreshold: '',
},
infrastructureFeeAccount: {
balance: '1',
__typename: 'Account',
}, },
}; };
} }
let asset: Asset; let asset: AssetFieldsFragment;
let props: DepositFormProps; let props: DepositFormProps;
const MOCK_ETH_ADDRESS = '0x72c22822A19D20DE7e426fB84aa047399Ddd8853'; const MOCK_ETH_ADDRESS = '0x72c22822A19D20DE7e426fB84aa047399Ddd8853';

View File

@ -38,6 +38,13 @@
"jestConfig": "libs/environment/jest.config.ts", "jestConfig": "libs/environment/jest.config.ts",
"passWithNoTests": true "passWithNoTests": true
} }
},
"build-spec": {
"executor": "@nrwl/workspace:run-commands",
"outputs": [],
"options": {
"command": "yarn tsc --project ./libs/environment/tsconfig.spec.json"
}
} }
} }
} }

View File

@ -138,6 +138,8 @@ describe('Network switcher', () => {
[Networks.TESTNET]: 'https://test.net', [Networks.TESTNET]: 'https://test.net',
[Networks.STAGNET3]: 'https://stag3.net', [Networks.STAGNET3]: 'https://stag3.net',
[Networks.DEVNET]: 'https://dev.net', [Networks.DEVNET]: 'https://dev.net',
[Networks.STAGNET1]: 'https://stag1.net',
[Networks.SANDBOX]: 'https://sandbox.net',
}; };
// @ts-ignore Typescript doesn't know about this module being mocked // @ts-ignore Typescript doesn't know about this module being mocked
useEnvironment.mockImplementation(() => ({ useEnvironment.mockImplementation(() => ({
@ -175,6 +177,8 @@ describe('Network switcher', () => {
[Networks.TESTNET]: 'https://test.net', [Networks.TESTNET]: 'https://test.net',
[Networks.STAGNET3]: 'https://stag3.net', [Networks.STAGNET3]: 'https://stag3.net',
[Networks.DEVNET]: 'https://dev.net', [Networks.DEVNET]: 'https://dev.net',
[Networks.STAGNET1]: 'https://stag1.net',
[Networks.SANDBOX]: 'https://sandbox.net',
}; };
// @ts-ignore Typescript doesn't know about this module being mocked // @ts-ignore Typescript doesn't know about this module being mocked
useEnvironment.mockImplementation(() => ({ useEnvironment.mockImplementation(() => ({
@ -205,6 +209,8 @@ describe('Network switcher', () => {
[Networks.TESTNET]: 'https://test.net', [Networks.TESTNET]: 'https://test.net',
[Networks.STAGNET3]: 'https://stag3.net', [Networks.STAGNET3]: 'https://stag3.net',
[Networks.DEVNET]: 'https://dev.net', [Networks.DEVNET]: 'https://dev.net',
[Networks.STAGNET1]: 'https://stag1.net',
[Networks.SANDBOX]: 'https://sandbox.net',
}; };
// @ts-ignore Typescript doesn't know about this module being mocked // @ts-ignore Typescript doesn't know about this module being mocked
useEnvironment.mockImplementation(() => ({ useEnvironment.mockImplementation(() => ({

View File

@ -69,6 +69,13 @@
"quiet": true "quiet": true
} }
} }
},
"build-spec": {
"executor": "@nrwl/workspace:run-commands",
"outputs": [],
"options": {
"command": "yarn tsc --project ./libs/fills/tsconfig.spec.json"
}
} }
} }
} }

View File

@ -38,6 +38,13 @@
"jestConfig": "libs/governance/jest.config.ts", "jestConfig": "libs/governance/jest.config.ts",
"passWithNoTests": true "passWithNoTests": true
} }
},
"build-spec": {
"executor": "@nrwl/workspace:run-commands",
"outputs": [],
"options": {
"command": "yarn tsc --project ./libs/governance/tsconfig.spec.json"
}
} }
} }
} }

View File

@ -38,6 +38,13 @@
"jestConfig": "libs/liquidity/jest.config.js", "jestConfig": "libs/liquidity/jest.config.js",
"passWithNoTests": true "passWithNoTests": true
} }
},
"build-spec": {
"executor": "@nrwl/workspace:run-commands",
"outputs": [],
"options": {
"command": "yarn tsc --project ./libs/liquidity/tsconfig.spec.json"
}
} }
} }
} }

View File

@ -69,6 +69,13 @@
"quiet": true "quiet": true
} }
} }
},
"build-spec": {
"executor": "@nrwl/workspace:run-commands",
"outputs": [],
"options": {
"command": "yarn tsc --project ./libs/market-depth/tsconfig.spec.json"
}
} }
} }
} }

View File

@ -6,6 +6,7 @@ describe('Orderbook', () => {
const params = { const params = {
numberOfSellRows: 100, numberOfSellRows: 100,
numberOfBuyRows: 100, numberOfBuyRows: 100,
step: 1,
midPrice: 122900, midPrice: 122900,
bestStaticBidPrice: 122905, bestStaticBidPrice: 122905,
bestStaticOfferPrice: 122895, bestStaticOfferPrice: 122895,

View File

@ -40,7 +40,6 @@ export const Continuous = Template.bind({});
Continuous.args = { Continuous.args = {
numberOfSellRows: 100, numberOfSellRows: 100,
numberOfBuyRows: 100, numberOfBuyRows: 100,
midPrice: 1000,
bestStaticBidPrice: 1000, bestStaticBidPrice: 1000,
bestStaticOfferPrice: 1000, bestStaticOfferPrice: 1000,
decimalPlaces: 3, decimalPlaces: 3,
@ -51,7 +50,6 @@ export const Auction = Template.bind({});
Auction.args = { Auction.args = {
numberOfSellRows: 100, numberOfSellRows: 100,
numberOfBuyRows: 100, numberOfBuyRows: 100,
midPrice: 122900,
bestStaticBidPrice: 122905, bestStaticBidPrice: 122905,
bestStaticOfferPrice: 122895, bestStaticOfferPrice: 122895,
decimalPlaces: 3, decimalPlaces: 3,
@ -64,7 +62,6 @@ export const Empty = Template.bind({});
Empty.args = { Empty.args = {
numberOfSellRows: 0, numberOfSellRows: 0,
numberOfBuyRows: 0, numberOfBuyRows: 0,
midPrice: 0,
bestStaticBidPrice: 0, bestStaticBidPrice: 0,
bestStaticOfferPrice: 0, bestStaticOfferPrice: 0,
decimalPlaces: 3, decimalPlaces: 3,

View File

@ -5,6 +5,7 @@
"module": "commonjs", "module": "commonjs",
"types": ["jest", "node", "@testing-library/jest-dom"] "types": ["jest", "node", "@testing-library/jest-dom"]
}, },
"files": ["../../node_modules/@nrwl/react/typings/cssmodule.d.ts"],
"include": [ "include": [
"**/*.test.ts", "**/*.test.ts",
"**/*.spec.ts", "**/*.spec.ts",

View File

@ -38,6 +38,13 @@
"jestConfig": "libs/market-info/jest.config.ts", "jestConfig": "libs/market-info/jest.config.ts",
"passWithNoTests": true "passWithNoTests": true
} }
},
"build-spec": {
"executor": "@nrwl/workspace:run-commands",
"outputs": [],
"options": {
"command": "yarn tsc --project ./libs/market-info/tsconfig.spec.json"
}
} }
} }
} }

View File

@ -38,6 +38,13 @@
"jestConfig": "libs/market-list/jest.config.ts", "jestConfig": "libs/market-list/jest.config.ts",
"passWithNoTests": true "passWithNoTests": true
} }
},
"build-spec": {
"executor": "@nrwl/workspace:run-commands",
"outputs": [],
"options": {
"command": "yarn tsc --project ./libs/market-list/tsconfig.spec.json"
}
} }
} }
} }

View File

@ -38,6 +38,13 @@
"jestConfig": "libs/network-info/jest.config.ts", "jestConfig": "libs/network-info/jest.config.ts",
"passWithNoTests": true "passWithNoTests": true
} }
},
"build-spec": {
"executor": "@nrwl/workspace:run-commands",
"outputs": [],
"options": {
"command": "yarn tsc --project ./libs/network-info/tsconfig.spec.json"
}
} }
} }
} }

View File

@ -38,6 +38,13 @@
"jestConfig": "libs/network-stats/jest.config.ts", "jestConfig": "libs/network-stats/jest.config.ts",
"passWithNoTests": true "passWithNoTests": true
} }
},
"build-spec": {
"executor": "@nrwl/workspace:run-commands",
"outputs": [],
"options": {
"command": "yarn tsc --project ./libs/network-stats/tsconfig.spec.json"
}
} }
} }
} }

View File

@ -69,6 +69,13 @@
"quiet": true "quiet": true
} }
} }
},
"build-spec": {
"executor": "@nrwl/workspace:run-commands",
"outputs": [],
"options": {
"command": "yarn tsc --project ./libs/orders/tsconfig.spec.json"
}
} }
} }
} }

View File

@ -7,7 +7,7 @@ import type { OrderEvent } from './';
import { ORDER_EVENT_SUB } from './order-event-query'; import { ORDER_EVENT_SUB } from './order-event-query';
import type { MockedResponse } from '@apollo/client/testing'; import type { MockedResponse } from '@apollo/client/testing';
import { MockedProvider } from '@apollo/client/testing'; import { MockedProvider } from '@apollo/client/testing';
import type { OrderWithMarket } from '../components'; import type { Order } from '../components';
import { generateOrder } from '../components'; import { generateOrder } from '../components';
import { import {
OrderStatus, OrderStatus,
@ -27,10 +27,7 @@ const defaultWalletContext = {
connector: null, connector: null,
}; };
function setup( function setup(order: Order, context?: Partial<VegaWalletContextShape>) {
order: OrderWithMarket,
context?: Partial<VegaWalletContextShape>
) {
const mocks: MockedResponse<OrderEvent> = { const mocks: MockedResponse<OrderEvent> = {
request: { request: {
query: ORDER_EVENT_SUB, query: ORDER_EVENT_SUB,

View File

@ -69,6 +69,13 @@
"quiet": true "quiet": true
} }
} }
},
"build-spec": {
"executor": "@nrwl/workspace:run-commands",
"outputs": [],
"options": {
"command": "yarn tsc --project ./libs/positions/tsconfig.spec.json"
}
} }
} }
} }

View File

@ -22,6 +22,7 @@ describe('Close position dialog - Request', () => {
market: null, market: null,
marketData: null, marketData: null,
orders: [], orders: [],
loading: false,
}); });
render(<Requested {...props} />); render(<Requested {...props} />);
expect(screen.getByText('Loading...')).toBeInTheDocument(); expect(screen.getByText('Loading...')).toBeInTheDocument();

View File

@ -1,3 +1,4 @@
import BigNumber from 'bignumber.js';
import type { Story, Meta } from '@storybook/react'; import type { Story, Meta } from '@storybook/react';
import { PositionsTable } from './positions-table'; import { PositionsTable } from './positions-table';
import type { Position } from './positions-data-providers'; import type { Position } from './positions-data-providers';
@ -28,7 +29,7 @@ const longPosition: Position = {
// leverageSearch: '0', // leverageSearch: '0',
liquidationPrice: '1129935', liquidationPrice: '1129935',
lowMarginLevel: false, lowMarginLevel: false,
// marginAccountBalance: '0', marginAccountBalance: new BigNumber('0'),
// marginMaintenance: '0', // marginMaintenance: '0',
// marginSearch: '0', // marginSearch: '0',
// marginInitial: '0', // marginInitial: '0',
@ -60,7 +61,7 @@ const shortPosition: Position = {
// leverageSearch: '0', // leverageSearch: '0',
liquidationPrice: '23734', liquidationPrice: '23734',
lowMarginLevel: false, lowMarginLevel: false,
// marginAccountBalance: '0', marginAccountBalance: new BigNumber('0'),
// marginMaintenance: '0', // marginMaintenance: '0',
// marginSearch: '0', // marginSearch: '0',
// marginInitial: '0', // marginInitial: '0',

View File

@ -38,6 +38,13 @@
"jestConfig": "libs/react-helpers/jest.config.ts", "jestConfig": "libs/react-helpers/jest.config.ts",
"passWithNoTests": true "passWithNoTests": true
} }
},
"build-spec": {
"executor": "@nrwl/workspace:run-commands",
"outputs": [],
"options": {
"command": "yarn tsc --project ./libs/react-helpers/tsconfig.spec.json"
}
} }
} }
} }

View File

@ -10,7 +10,7 @@ import {
useNetworkParams, useNetworkParams,
} from './use-network-params'; } from './use-network-params';
import type { ReactNode } from 'react'; import type { ReactNode } from 'react';
import type { NetworkParams as NetworkParamsResponse } from './__generated__'; import type { NetworkParams as NetworkParamsResponse } from './__generated__/NetworkParams';
describe('useNetworkParam', () => { describe('useNetworkParam', () => {
const setup = (arg: NetworkParamsKey) => { const setup = (arg: NetworkParamsKey) => {

View File

@ -3,7 +3,7 @@
"compilerOptions": { "compilerOptions": {
"outDir": "../../dist/out-tsc", "outDir": "../../dist/out-tsc",
"module": "commonjs", "module": "commonjs",
"types": ["jest", "node"] "types": ["jest", "node", "@testing-library/jest-dom"]
}, },
"include": [ "include": [
"**/*.test.ts", "**/*.test.ts",

View File

@ -26,6 +26,13 @@
"jestConfig": "libs/smart-contracts/jest.config.ts", "jestConfig": "libs/smart-contracts/jest.config.ts",
"passWithNoTests": true "passWithNoTests": true
} }
},
"build-spec": {
"executor": "@nrwl/workspace:run-commands",
"outputs": [],
"options": {
"command": "yarn tsc --project ./libs/smart-contracts/tsconfig.spec.json"
}
} }
}, },
"tags": [] "tags": []

View File

@ -38,6 +38,13 @@
"jestConfig": "libs/trades/jest.config.ts", "jestConfig": "libs/trades/jest.config.ts",
"passWithNoTests": true "passWithNoTests": true
} }
},
"build-spec": {
"executor": "@nrwl/workspace:run-commands",
"outputs": [],
"options": {
"command": "yarn tsc --project ./libs/trades/tsconfig.spec.json"
}
} }
} }
} }

View File

@ -1,9 +1,9 @@
import { act, render, screen } from '@testing-library/react'; import { act, render, screen } from '@testing-library/react';
import { getDateTimeFormat } from '@vegaprotocol/react-helpers'; import { getDateTimeFormat } from '@vegaprotocol/react-helpers';
import { DOWN_CLASS, TradesTable, UP_CLASS } from './trades-table'; import { DOWN_CLASS, TradesTable, UP_CLASS } from './trades-table';
import type { TradeFields } from './__generated__/TradeFields'; import type { Trade } from './trades-data-provider';
const trade: TradeFields = { const trade: Trade = {
__typename: 'Trade', __typename: 'Trade',
id: 'trade-id', id: 'trade-id',
price: '111122200', price: '111122200',
@ -14,7 +14,7 @@ const trade: TradeFields = {
id: 'market-id', id: 'market-id',
decimalPlaces: 2, decimalPlaces: 2,
positionDecimalPlaces: 2, positionDecimalPlaces: 2,
}, } as Trade['market'],
}; };
it('Correct columns are rendered', async () => { it('Correct columns are rendered', async () => {

View File

@ -69,6 +69,13 @@
"quiet": true "quiet": true
} }
} }
},
"build-spec": {
"executor": "@nrwl/workspace:run-commands",
"outputs": [],
"options": {
"command": "yarn tsc --project ./libs/ui-toolkit/tsconfig.spec.json"
}
} }
} }
} }

View File

@ -6,6 +6,7 @@ describe('ThemeSwitcher', () => {
it('should render successfully', () => { it('should render successfully', () => {
const { baseElement } = render( const { baseElement } = render(
<ThemeSwitcher <ThemeSwitcher
theme="dark"
onToggle={() => { onToggle={() => {
return; return;
}} }}

View File

@ -17,7 +17,7 @@ export const VegaLogo = () => {
); );
}; };
export const VLogo = ({ className }: { className: string }) => { export const VLogo = ({ className }: { className?: string }) => {
return ( return (
<svg <svg
aria-label={t('Vega logo')} aria-label={t('Vega logo')}

View File

@ -38,6 +38,13 @@
"jestConfig": "libs/wallet/jest.config.ts", "jestConfig": "libs/wallet/jest.config.ts",
"passWithNoTests": true "passWithNoTests": true
} }
},
"build-spec": {
"executor": "@nrwl/workspace:run-commands",
"outputs": [],
"options": {
"command": "yarn tsc --project ./libs/wallet/tsconfig.spec.json"
}
} }
} }
} }

View File

@ -38,6 +38,13 @@
"jestConfig": "libs/web3/jest.config.ts", "jestConfig": "libs/web3/jest.config.ts",
"passWithNoTests": true "passWithNoTests": true
} }
},
"build-spec": {
"executor": "@nrwl/workspace:run-commands",
"outputs": [],
"options": {
"command": "yarn tsc --project ./libs/web3/tsconfig.spec.json"
}
} }
} }
} }

View File

@ -38,6 +38,13 @@
"jestConfig": "libs/withdraws/jest.config.ts", "jestConfig": "libs/withdraws/jest.config.ts",
"passWithNoTests": true "passWithNoTests": true
} }
},
"build-spec": {
"executor": "@nrwl/workspace:run-commands",
"outputs": [],
"options": {
"command": "yarn tsc --project ./libs/withdraws/tsconfig.spec.json"
}
} }
} }
} }