Selaa lähdekoodia

chore: remove babel and tests

Pouria Ezzati 3 vuotta sitten
vanhempi
säilyke
e255d50458

+ 0 - 10
.babelrc

@@ -1,10 +0,0 @@
-{
-  "presets": ["next/babel"],
-  "plugins": [
-    [
-      "styled-components",
-      { "ssr": true, "displayName": true, "preprocess": false }
-    ],
-    "inline-react-svg"
-  ]
-}

+ 0 - 52
client/components/__tests__/footer.test.tsx

@@ -1,52 +0,0 @@
-import React from "react";
-import { render } from "@testing-library/react";
-import { StoreProvider } from "easy-peasy";
-import { initializeStore } from "../../store";
-import Footer from "../Footer";
-import getConfig from "next/config";
-
-describe("<Footer /> component test", () => {
-  let app;
-
-  beforeEach(() => {
-    const store = initializeStore();
-    app = (
-      <StoreProvider store={store}>
-        <Footer />
-      </StoreProvider>
-    );
-  });
-
-  it("should contain a github link", () => {
-    const screen = render(app);
-    const githubLink = screen.getByRole("link", { name: "GitHub" });
-    expect(githubLink).toHaveAttribute("href", "https://github.com/thedevs-network/kutt");
-  });
-
-  it("should contain a TOS link", () => {
-    const config = getConfig();
-    const screen = render(app);
-    const tosLink = screen.getByRole("link", { name: "Terms of Service" });
-
-    expect(tosLink).toHaveAttribute("href", "/terms");
-  });
-
-  it("should show contact email if defined", () => {
-    const config = getConfig();
-    config.publicRuntimeConfig.CONTACT_EMAIL = 'foobar';
-    const screen = render(app);
-    const emailLink = screen.getByRole("link", { name: "Contact us" });
-
-    expect(emailLink).toHaveAttribute("href", "mailto:foobar");
-  });
-
-  it("should NOT show contact email if none is defined", () => {
-    const config = getConfig();
-    delete(config.publicRuntimeConfig.CONTACT_EMAIL);
-    const screen = render(app);
-    const emailLink= screen.queryByRole("link", { name: "Contact us" });
-
-    expect(emailLink).toBeNull();
-  });
-})
-

+ 0 - 59
client/components/__tests__/shortener.test.tsx

@@ -1,59 +0,0 @@
-import React from "react";
-import { render } from "@testing-library/react";
-import { StoreProvider, createStore, thunk } from "easy-peasy";
-import userEvent from "@testing-library/user-event"
-import { store } from "../../store";
-import Shortener from "../Shortener";
-
-describe("<Shortener /> component test", () => {
-  let app;
-
-  beforeEach(() => {
-    store.links = {
-      ...store.links,
-      submit: thunk(async (actions, payload) => {
-        return {
-          id: "0",
-          address: "localhost:3000/foobar",
-          banned: false,
-          created_at: "now",
-          link: "localhost:3000/foobar",
-          target: "",
-          updated_at: "now",
-          visit_count: 0
-        };
-      })
-    };
-    const testStore = createStore(store);
-    app = (
-      <StoreProvider store={testStore}>
-        <Shortener />
-      </StoreProvider>
-    );
-  });
-
-  it("Should show the short URL", async () => {
-    const screen = render(app);
-    const urlInput = screen.getByRole("textbox", { name: "target" });
-    userEvent.type(urlInput, "https://easy-peasy.now.sh/docs/api/thunk.html");
-    const submitButton = screen.getByRole("button", { name: "submit" });
-    userEvent.click(submitButton);
-    const msg = await screen.findByText(/localhost:3000\/foobar/i);
-    expect(msg).toBeInTheDocument();
-  });
-
-  it("Should empty target input", async () => {
-    const screen = render(app);
-    let urlInput: HTMLInputElement = screen.getByRole("textbox", {
-      name: "target"
-    }) as HTMLInputElement;
-    userEvent.type(urlInput, "https://easy-peasy.now.sh/docs/api/thunk.html");
-    const submitButton = screen.getByRole("button", { name: "submit" });
-    userEvent.click(submitButton);
-    await screen.findByText(/localhost:3000\/foobar/i);
-    urlInput = screen.getByRole("textbox", {
-      name: "target"
-    }) as HTMLInputElement;
-    expect(urlInput.value).toEqual("");
-  });
-});

+ 0 - 13
jest.config.js

@@ -1,13 +0,0 @@
-module.exports = {
-  setupFilesAfterEnv: ['<rootDir>/jest-setup.ts'],
-  "preset": "ts-jest",
-  "transform": {
-    "^.+\\.js$": "babel-jest"
-  },
-  "testEnvironment": "jsdom",
-  "globals": {
-    "ts-jest": {
-      "tsconfig": "<rootDir>/tsconfig.test.json"
-    }
-  }
-};