fix: fix test trade-table.spec

This commit is contained in:
Madalina Raicu 2023-01-27 17:58:55 +00:00
parent 87fbcb2994
commit 7ac4fbaa67
No known key found for this signature in database
GPG Key ID: 688B7B31149C1DCD

View File

@ -19,7 +19,8 @@ const trade: Trade = {
} as Trade['market'],
};
it('Correct columns are rendered', async () => {
describe('TradesTable', () => {
it('should render correct columns', async () => {
await act(async () => {
render(<TradesTable rowData={[trade]} />);
});
@ -29,7 +30,7 @@ it('Correct columns are rendered', async () => {
expect(headers.map((h) => h.textContent?.trim())).toEqual(expectedHeaders);
});
it('Number and data columns are formatted', async () => {
it('should format number and data columns', async () => {
await act(async () => {
render(<TradesTable rowData={[trade]} />);
});
@ -45,7 +46,7 @@ it('Number and data columns are formatted', async () => {
});
});
it('Price and size columns are formatted', async () => {
it('should format price and size columns', async () => {
const trade2 = {
...trade,
id: 'trade-id-2',
@ -65,13 +66,11 @@ it('Price and size columns are formatted', async () => {
(cell) => cell.getAttribute('col-id') === 'size'
);
// For first trade price should have green class and size should have red class
// For first trade price should have green class
// row 1
expect(priceCells[0]).toHaveClass(BUY_CLASS);
expect(priceCells[1]).not.toHaveClass(SELL_CLASS);
expect(priceCells[1]).not.toHaveClass(BUY_CLASS);
expect(sizeCells[0]).toHaveClass(SELL_CLASS);
expect(sizeCells[1]).not.toHaveClass(SELL_CLASS);
expect(sizeCells[1]).not.toHaveClass(BUY_CLASS);
});
});