chore: fix mocks and hydration error (#1520)

* chore: fix DealTicket mock

* chore: fix React Hydration Error

* test: change tag

Co-authored-by: Rado <szpiechrados@gmail.com>
This commit is contained in:
Bartłomiej Głownia 2022-09-28 23:40:21 +02:00 committed by GitHub
parent 8bffc05be2
commit 8dd63d7cac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 8 deletions

View File

@ -27,7 +27,7 @@ const mockTx = {
},
};
describe('deal ticket orders', { tags: '@regression' }, () => {
describe('deal ticket orders', { tags: '@smoke' }, () => {
before(() => {
cy.mockGQL((req) => {
mockTradingPage(req, MarketState.STATE_ACTIVE);
@ -158,7 +158,7 @@ describe('deal ticket orders', { tags: '@regression' }, () => {
it.skip('unsuccessful order due to no collateral');
});
describe('deal ticket validation', { tags: '@regression' }, () => {
describe('deal ticket validation', { tags: '@smoke' }, () => {
before(() => {
cy.mockGQL((req) => {
mockTradingPage(req, MarketState.STATE_ACTIVE);

View File

@ -43,11 +43,7 @@ export const mockTradingPage = (
aliasQuery(req, 'Orders', generateOrders());
aliasQuery(req, 'Accounts', generateAccounts());
aliasQuery(req, 'Positions', generatePositions());
aliasQuery(
req,
'DealTicketQuery',
generateDealTicketQuery({ market: { state } })
);
aliasQuery(req, 'DealTicket', generateDealTicketQuery({ market: { state } }));
aliasQuery(
req,
'MarketInfoQuery',

View File

@ -29,7 +29,8 @@ const toggleTheme = () => {
};
export function useThemeSwitcher(): [themeVariant, () => void] {
const [theme, setTheme] = useState<themeVariant>(getCurrentTheme());
const [theme, setTheme] = useState<themeVariant>(lightTheme);
useEffect(() => setTheme(getCurrentTheme()), []);
useEffect(() => {
if (theme === darkTheme) {
document.documentElement.classList.add(darkThemeCssClass);