Skip to content

Commit

Permalink
v4.1.1
Browse files Browse the repository at this point in the history
v4.1.1
  • Loading branch information
platschi authored Nov 1, 2022
2 parents efef16f + 55cbf55 commit 90b3d86
Show file tree
Hide file tree
Showing 615 changed files with 9,943 additions and 2,248 deletions.
13 changes: 0 additions & 13 deletions .github/workflows/audit_build_verify.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
name: Kwenta CI

on:
push:
pull_request:
branches: [main, dev]

jobs:
audit:
# run only on main/dev branch and pull requests
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev' || github.event_name == 'pull_request'
runs-on: ubuntu-latest

container:
Expand All @@ -25,9 +22,6 @@ jobs:
run: lockfile-lint -p package-lock.json --type npm --allowed-hosts npm github.com --allowed-schemes "https:" "git+ssh:" "npm:"

lint:
needs: audit
# run only on audit success or audit skipped
if: always() && (needs.audit.result == 'success' || needs.audit.result == 'skipped')
runs-on: ubuntu-latest

container:
Expand Down Expand Up @@ -63,21 +57,15 @@ jobs:
npm install --prefer-offline --no-audit --legacy-peer-deps
- name: Lint
# run only on main/dev branch and pull requests
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev' || github.event_name == 'pull_request'
run: npm run lint:sarif

- name: Upload lint results
# run if lint failed and only on main/dev branch and pull requests
if: always() && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev' || github.event_name == 'pull_request')
uses: github/codeql-action/upload-sarif@ec3cf9c605b848da5f1e41e8452719eb1ccfb9a6 # pin@codeql-bundle-20220322
with:
sarif_file: lint-results.sarif
continue-on-error: true

- name: Unit tests
# run only on main/dev branch and pull requests
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev' || github.event_name == 'pull_request'
run: npm run test:unit

build:
Expand Down Expand Up @@ -134,7 +122,6 @@ jobs:
run: tar -zcvf build.tar.gz .next

- name: Archive build
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev' || github.event_name == 'pull_request'
uses: actions/upload-artifact@83fd05a356d7e2593de66fc9913b3002723633cb # pin@v3
with:
name: build
Expand Down
14 changes: 6 additions & 8 deletions __tests__/pages/market.test.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { render, waitFor } from '@testing-library/react';
import { render } from '@testing-library/react';

import mockConnector from 'testing/unit/__mocks__/mockConnector';
import MockProviders from 'testing/unit/__mocks__/MockProviders';
import { mockGrapqhlRequest, mockReactQuery } from 'testing/unit/__mocks__/mockQueries';
import { TEST_ADDR } from 'testing/unit/constants';
import mockConnector from 'testing/unit/mocks/mockConnector';
import MockProviders from 'testing/unit/mocks/MockProviders';
import { mockGrapqhlRequest, mockReactQuery } from 'testing/unit/mocks/mockQueries';

import Market from '../../pages/market';

Expand Down Expand Up @@ -51,9 +51,7 @@ describe('Futures market page - cross margin', () => {
</MockProviders>
);

await waitFor(async () => {
const component = await findByTestId('set-order-size-amount-susd-desktop');
expect(component.hasAttribute('disabled'));
});
const component = await findByTestId('set-order-size-amount-susd-desktop');
expect(component.hasAttribute('disabled'));
});
});
10 changes: 7 additions & 3 deletions components/Input/NumericInput.test.tsx
Original file line number Diff line number Diff line change
@@ -1,33 +1,37 @@
import { render } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { wait } from '@testing-library/user-event/dist/utils';

import ContextProvider from 'testing/unit/__mocks__/MockProviders';
import ContextProvider from 'testing/unit/mocks/MockProviders';

import NumericInput from './NumericInput';

describe('NumericInput', () => {
test('happy path', () => {
test('happy path', async () => {
const onChangeMock = jest.fn();

const result = render(
<ContextProvider>
<NumericInput value={''} onChange={onChangeMock} placeholder={'MyNumericInput'} />
</ContextProvider>
);
await wait(1000);

const input = result.getByPlaceholderText('MyNumericInput');
expect(input).toBeInTheDocument();
expect(input).toHaveValue(null);
userEvent.type(input, '1');
expect(onChangeMock).toBeCalledWith(expect.any(Object), '1');
});
test('ignores non number', () => {
test('ignores non number', async () => {
const onChangeMock = jest.fn();

const result = render(
<ContextProvider>
<NumericInput value={''} onChange={onChangeMock} placeholder={'MyNumericInput'} />
</ContextProvider>
);
await wait(1000);
const input = result.getByPlaceholderText('MyNumericInput');
expect(input).toBeInTheDocument();
expect(input).toHaveValue(null);
Expand Down
30 changes: 4 additions & 26 deletions components/Slider/Slider.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
import Slider, {
SliderProps as DefaultSliderProps,
ValueLabelProps,
} from '@material-ui/core/Slider';
import Tooltip from '@material-ui/core/Tooltip';
import { withStyles } from '@material-ui/styles';
import Slider, { SliderProps as DefaultSliderProps } from '@material-ui/core/Slider';
import React from 'react';
import styled, { css } from 'styled-components';

import media from 'styles/media';

import ValueLabel from './ValueLabel';

export type SliderProps = Omit<DefaultSliderProps, 'onChange'> & {
minValue: number;
maxValue: number;
Expand Down Expand Up @@ -41,7 +38,7 @@ const SliderComponent: React.FC<SliderProps> = ({
value={value}
onChange={onChange}
onChangeCommitted={onChangeCommitted}
ValueLabelComponent={ValueLabelComponent}
ValueLabelComponent={ValueLabel}
disabled={disabled}
{...props}
className={className}
Expand All @@ -50,27 +47,8 @@ const SliderComponent: React.FC<SliderProps> = ({
);
};

const TextOnlyTooltip = withStyles((theme) => ({
tooltip: {
color: theme.palette.colors.selectedTheme.text.value,
marginTop: '1px',
fontSize: '13px',
backgroundColor: 'transparent',
},
}))(Tooltip);

export default SliderComponent;

function ValueLabelComponent(props: ValueLabelProps) {
const { children, open, value } = props;

return (
<TextOnlyTooltip open={open} enterTouchDelay={0} placement="bottom" title={value}>
{children}
</TextOnlyTooltip>
);
}

const styledMarkLabel = css`
font-family: ${(props) => props.theme.fonts.mono};
font-size: 13px;
Expand Down
21 changes: 21 additions & 0 deletions components/Slider/ValueLabel.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { Tooltip, ValueLabelProps, withStyles } from '@material-ui/core';

const TextOnlyTooltip = withStyles((theme) => ({
tooltip: {
// @ts-ignore theme.palette type
color: theme.palette.colors.selectedTheme.text.value,
marginTop: '1px',
fontSize: '13px',
backgroundColor: 'transparent',
},
}))(Tooltip);

export default function ValueLabel(props: ValueLabelProps) {
const { children, open, value } = props;

return (
<TextOnlyTooltip open={open} enterTouchDelay={0} placement="bottom" title={value}>
{children}
</TextOnlyTooltip>
);
}
3 changes: 3 additions & 0 deletions components/Slider/__mocks__/ValueLabel.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default function MockValueLabel() {
return <div />;
}
Loading

1 comment on commit 90b3d86

@vercel
Copy link

@vercel vercel bot commented on 90b3d86 Nov 1, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

kwenta – ./

kwenta-git-main-kwenta.vercel.app
kwenta.io
kwenta-kwenta.vercel.app

Please sign in to comment.