Dependencies updated & small enhancements (#27)

* Dependencies updated and imports shortened

* Head tags refactored

* Final tweaks
This commit is contained in:
David
2021-06-12 22:44:56 +02:00
committed by GitHub
parent 030de63b2a
commit bdaced0457
29 changed files with 2523 additions and 3373 deletions

View File

@@ -1,6 +1,6 @@
import { render, screen } from "../reactUtils";
import { render, screen } from "@tests/reactUtils";
import faker from "faker";
import CustomError from "../../components/CustomError";
import CustomError from "@components/CustomError";
const code = faker.datatype.number({ min: 400, max: 599 });
const text = faker.random.words();

View File

@@ -1,9 +1,9 @@
import { render, screen, waitFor } from "../reactUtils";
import { htmlRes, resolveFetchWith } from "../commonUtils";
import { render, screen, waitFor } from "@tests/reactUtils";
import { htmlRes, resolveFetchWith } from "@tests/commonUtils";
import userEvent from "@testing-library/user-event";
import Router from "next/router";
import faker from "faker";
import Page, { getStaticProps } from "../../pages/[[...slug]]";
import Page, { getStaticProps } from "@pages/[[...slug]]";
const mockPush = jest.spyOn(Router, "push").mockImplementation(async () => true);

View File

@@ -1,8 +1,8 @@
import { createTestClient } from "apollo-server-testing";
import { ApolloServer } from "apollo-server-micro";
import faker from "faker";
import { htmlRes, resolveFetchWith } from "../../commonUtils";
import { typeDefs, resolvers } from "../../../pages/api/graphql";
import { htmlRes, resolveFetchWith } from "@tests/commonUtils";
import { typeDefs, resolvers } from "@pages/api/graphql";
beforeEach(() => {
fetchMock.resetMocks();

View File

@@ -1,7 +1,7 @@
import httpMocks from "node-mocks-http";
import faker from "faker";
import { htmlRes, resolveFetchWith } from "../../../commonUtils";
import handler from "../../../../pages/api/v1/[[...slug]]";
import { htmlRes, resolveFetchWith } from "@tests/commonUtils";
import handler from "@pages/api/v1/[[...slug]]";
beforeEach(() => {
fetchMock.resetMocks();

View File

@@ -1,7 +1,8 @@
import { FC, ReactElement } from "react";
import { render, RenderOptions } from "@testing-library/react";
import { ChakraProvider } from "@chakra-ui/react";
import theme from "../theme";
import theme from "@theme";
import { Layout } from "@components";
// Jest JSDOM bug
Object.defineProperty(window, 'matchMedia', {
@@ -20,7 +21,9 @@ Object.defineProperty(window, 'matchMedia', {
const Providers: FC = ({ children }) => (
<ChakraProvider theme={theme}>
{children}
<Layout>
{children}
</Layout>
</ChakraProvider>
);

View File

@@ -1,5 +1,5 @@
import { replaceBoth, retrieveFiltered, CheckType, LangType } from "../../utils/language";
import { languages, exceptions, mappings } from "../../utils/languages.json";
import { replaceBoth, retrieveFiltered, CheckType, LangType } from "@utils/language";
import { languages, exceptions, mappings } from "@utils/languages.json";
describe("replaceBoth", () => {
const testReplacer = (

View File

@@ -1,5 +1,5 @@
import faker from "faker";
import langReducer, { Actions, initialState } from "../../utils/reducer";
import langReducer, { Actions, initialState } from "@utils/reducer";
it("changes a field value", () => {
const query = faker.random.words();

View File

@@ -1,6 +1,6 @@
import { htmlRes, resolveFetchWith } from "../commonUtils";
import { htmlRes, resolveFetchWith } from "@tests/commonUtils";
import faker from "faker";
import { googleScrape, extractSlug, textToSpeechScrape } from "../../utils/translate";
import { googleScrape, extractSlug, textToSpeechScrape } from "@utils/translate";
const source = faker.random.locale();
const target = faker.random.locale();