Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
charliewilco committed Mar 5, 2023
2 parents daf2546 + a1e0cf2 commit 16d2277
Show file tree
Hide file tree
Showing 22 changed files with 4,043 additions and 2,130 deletions.
3 changes: 3 additions & 0 deletions apps/browser-extension/.parcelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "@parcel/config-webextension"
}
27 changes: 15 additions & 12 deletions apps/browser-extension/package.json
Original file line number Diff line number Diff line change
@@ -1,36 +1,39 @@
{
"name": "@reubin/extension",
"version": "1.2.1",
"version": "1.2.3",
"private": true,
"scripts": {
"dev": "parcel watch src/manifest.json --host localhost --config @parcel/config-webextension",
"build": "parcel build src/manifest.json --no-source-maps --config @parcel/config-webextension",
"dev": "parcel watch src/manifest.json --host localhost",
"build": "parcel build src/manifest.json --no-source-maps",
"test": "jest --verbose",
"types": "tsc --noEmit --pretty"
},
"dependencies": {
"react": "^18.2.0",
"react-dom": "^18.2.0",
"swr": "^2.0.3"
"swr": "^2.0.4"
},
"devDependencies": {
"@tailwindcss/aspect-ratio": "^0.4.2",
"@tailwindcss/forms": "^0.5.3",
"@tailwindcss/typography": "^0.5.9",
"@parcel/config-webextension": "^2.8.3",
"@types/chrome": "^0.0.200",
"@parcel/packager-webextension": "2.8.3",
"@parcel/runtime-webextension": "2.8.3",
"@parcel/transformer-webextension": "^2.8.3",
"@types/chrome": "^0.0.219",
"@types/react": "^18.0.27",
"@types/react-dom": "^18.0.10",
"lightningcss": "^1.18.0",
"lightningcss": "^1.19.0",
"parcel": "^2.8.3",
"tailwindcss": "^3.2.4",
"typescript": "^4.9.4",
"tailwindcss": "^3.2.7",
"typescript": "^4.9.5",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^13.4.0",
"@testing-library/react": "^14.0.0",
"@testing-library/user-event": "^14.4.3",
"@types/jest": "^29.2.6",
"jest": "^29.3.1",
"jest-environment-jsdom": "^29.3.1",
"@types/jest": "^29.4.0",
"jest": "^29.4.3",
"jest-environment-jsdom": "^29.4.3",
"ts-jest": "^29.0.5"
}
}
44 changes: 22 additions & 22 deletions apps/graphql/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@reubin/graphql",
"version": "1.2.1",
"version": "1.2.3",
"type": "module",
"private": true,
"scripts": {
Expand All @@ -12,33 +12,18 @@
"types": "tsc --noEmit --pretty",
"test": "jest --runInBand"
},
"devDependencies": {
"@apollo/rover": "^0.10.0",
"@rollup/plugin-graphql": "^2.0.2",
"@rollup/plugin-run": "^3.0.1",
"@rollup/plugin-typescript": "^11.0.0",
"@types/jest": "^29.2.6",
"@types/node": "^18.11.18",
"babel-jest": "^29.3.1",
"cuid": "^2.1.8",
"jest": "^29.3.1",
"prisma": "^4.9.0",
"rollup": "^3.10.0",
"ts-jest": "^29.0.5",
"typescript": "^4.9.4"
},
"dependencies": {
"@apollo/server": "^4.3.0",
"@graphql-tools/schema": "^9.0.13",
"@graphql-tools/utils": "^9.1.4",
"@prisma/client": "^4.9.0",
"@apollo/server": "^4.4.1",
"@graphql-tools/schema": "^9.0.16",
"@graphql-tools/utils": "^9.2.1",
"@prisma/client": "^4.11.0",
"@reubin/graphql-date-ts": "*",
"@reubin/purify-html": "*",
"@reubin/rsskit": "*",
"@types/base-64": "^1.0.0",
"@types/bcryptjs": "^2.4.2",
"@types/jsonwebtoken": "^9.0.1",
"axios": "^1.2.2",
"axios": "^1.3.4",
"base-64": "^1.0.0",
"bcryptjs": "^2.4.3",
"date-fns": "^2.29.3",
Expand All @@ -50,6 +35,21 @@
"nexus": "^1.3.0",
"universal-cookie": "^4.0.4",
"xml2js": "^0.4.23",
"zod": "^3.20.2"
"zod": "^3.20.6"
},
"devDependencies": {
"@apollo/rover": "^0.12.2",
"@paralleldrive/cuid2": "^2.2.0",
"@rollup/plugin-graphql": "^2.0.2",
"@rollup/plugin-run": "^3.0.1",
"@rollup/plugin-typescript": "^11.0.0",
"@types/jest": "^29.4.0",
"@types/node": "^18.14.6",
"babel-jest": "^29.4.3",
"jest": "^29.4.3",
"prisma": "^4.11.0",
"rollup": "^3.18.0",
"ts-jest": "^29.0.5",
"typescript": "^4.9.5"
}
}
4 changes: 2 additions & 2 deletions apps/graphql/test/fixtures/mocks.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import base64 from "base-64";
import cuid from "cuid";
import cuid from "@paralleldrive/cuid2";

export class TestingMocks {
user: { email: string; password: string };
Expand All @@ -10,7 +10,7 @@ export class TestingMocks {

constructor() {
this.user = {
email: `test-${cuid()}@charlieisamazing.com`,
email: `test-${cuid.createId()}@charlieisamazing.com`,
password: base64.encode("P@ssw0rd"),
};
}
Expand Down
1 change: 1 addition & 0 deletions apps/ui/next-env.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />
/// <reference types="next/navigation-types/compat/navigation" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.
39 changes: 19 additions & 20 deletions apps/ui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@reubin/ui",
"version": "1.2.1",
"version": "1.2.3",
"scripts": {
"dev": "next dev",
"build": "next build",
Expand All @@ -10,44 +10,43 @@
"types": "tsc --noEmit --pretty"
},
"dependencies": {
"@apollo/client": "^3.7.3",
"@headlessui/react": "^1.7.7",
"@next/env": "^13.1.4",
"@next/font": "^13.1.4",
"@apollo/client": "^3.7.9",
"@headlessui/react": "^1.7.13",
"@tailwindcss/aspect-ratio": "^0.4.2",
"@tailwindcss/forms": "^0.5.3",
"@tailwindcss/typography": "^0.5.9",
"autoprefixer": "^10.4.13",
"date-fns": "^2.29.3",
"fathom-client": "^3.5.0",
"graphql-request": "^5.1.0",
"graphql-request": "5.1.0",
"graphql-tag": "^2.12.6",
"lucide-react": "^0.105.0",
"next": "^13.1.4",
"next": "^13.2.3",
"postcss": "^8.4.21",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-fast-compare": "^3.2.0",
"sharp": "^0.31.3",
"styled-jsx": "5.1.2",
"swr": "^2.0.3",
"tailwindcss": "^3.2.4",
"typescript": "^4.9.4",
"tailwindcss": "^3.2.7",
"typescript": "^4.9.5",
"universal-cookie": "^4.0.4",
"valtio": "^1.8.2",
"zod": "^3.20.2"
"valtio": "^1.10.3",
"zod": "^3.20.6"
},
"devDependencies": {
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^13.4.0",
"@testing-library/react": "^14.0.0",
"@testing-library/user-event": "^14.4.3",
"@types/jest": "^29.2.6",
"@types/node": "^18.11.18",
"@types/react": "^18.0.26",
"@types/react-dom": "^18.0.10",
"@types/jest": "^29.4.0",
"@types/node": "^18.14.6",
"@types/react": "^18.0.28",
"@types/react-dom": "^18.0.11",
"eslint": "^8.31.0",
"eslint-config-next": "^13.1.4",
"jest": "^29.3.1",
"jest-environment-jsdom": "^29.3.1",
"msw": "^0.49.2"
"eslint-config-next": "^13.2.3",
"jest": "^29.4.3",
"jest-environment-jsdom": "^29.4.3",
"msw": "^1.1.0"
}
}
16 changes: 10 additions & 6 deletions apps/ui/test/add-feed.test.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { render, screen } from "@testing-library/react";
import { act, render, screen } from "@testing-library/react";
import userEvent from "@testing-library/user-event";

import { AddFeedForm } from "../src/components/add-feed";
Expand All @@ -16,16 +16,20 @@ describe("AddFeed", () => {
const input = screen.getByTestId("add-feed-url");
const button = screen.getByText("Submit");

await userEvent.click(button);
await act(async () => {
await userEvent.click(button);
});

expect(fn).not.toHaveBeenCalled();

await userEvent.type(input, "https://www.google.com");
await act(async () => {
await userEvent.type(input, "https://www.google.com");
});

expect(input).toHaveValue("https://www.google.com");

await userEvent.click(button);

await act(async () => {
await userEvent.click(button);
});
expect(fn).toHaveBeenCalled();
});
});
14 changes: 8 additions & 6 deletions apps/ui/test/feed-settings.test.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { render, screen, fireEvent } from "@testing-library/react";
import { render, screen, fireEvent, act } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
import { graphql } from "msw";
import { setupServer } from "msw/node";
Expand Down Expand Up @@ -63,8 +63,11 @@ describe("Feed Settings", () => {

const button = screen.getByText("Save");
const input = screen.getByTestId("update-feed-name");
await userEvent.clear(input);
await userEvent.type(input, "New Feed");

await act(async () => {
await userEvent.clear(input);
await userEvent.type(input, "New Feed");
});

fireEvent(button, new MouseEvent("click", { bubbles: true }));

Expand All @@ -75,9 +78,8 @@ describe("Feed Settings", () => {
const onDelete = jest.fn();
render(<UpdateFeedForm initialFeed={mockFeed} onSubmit={jest.fn()} onDelete={onDelete} />);

const button = screen.getByText("Unsubscribe");

fireEvent(button, new MouseEvent("click", { bubbles: true }));
expect(screen.getByText("Unsubscribe")).toBeInTheDocument();
fireEvent(screen.getByText("Unsubscribe"), new MouseEvent("click", { bubbles: true }));
expect(onDelete).toHaveBeenCalled();
});
});
19 changes: 10 additions & 9 deletions apps/ui/test/login.test.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { render, screen } from "@testing-library/react";
import { render, screen, act } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
import { graphql } from "msw";
import { setupServer } from "msw/node";
Expand Down Expand Up @@ -64,9 +64,10 @@ describe("Login", () => {
const emailInput = screen.getByTestId("login-email-input");
// const passwordInput = screen.getByTestId("login-password-input");

await userEvent.type(emailInput, "matt@");

await userEvent.tab();
await act(async () => {
await userEvent.type(emailInput, "matt@");
await userEvent.tab();
});

expect(screen.getByText("Invalid email")).toBeInTheDocument();
expect(screen.getByRole("button")).toBeDisabled();
Expand All @@ -77,11 +78,11 @@ describe("Login", () => {

const emailInput = screen.getByTestId("login-email-input");
const passwordInput = screen.getByTestId("login-password-input");
await userEvent.type(emailInput, "[email protected]");

await userEvent.type(passwordInput, "P@ssw0rd");

await userEvent.click(screen.getByRole("button"));
await act(async () => {
await userEvent.type(emailInput, "[email protected]");
await userEvent.type(passwordInput, "P@ssw0rd");
await userEvent.click(screen.getByRole("button"));
});

expect(loginHandler).toBeCalledWith({
email: "[email protected]",
Expand Down
18 changes: 10 additions & 8 deletions apps/ui/test/register.test.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { render, screen } from "@testing-library/react";
import { act, render, screen } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
import { graphql } from "msw";
import { setupServer } from "msw/node";
Expand Down Expand Up @@ -63,9 +63,10 @@ describe("Login", () => {

const emailInput = screen.getByTestId("register-email-input");

await userEvent.type(emailInput, "matt@");

await userEvent.tab();
await act(async () => {
await userEvent.type(emailInput, "matt@");
await userEvent.tab();
});

expect(screen.getByText("Invalid email")).toBeInTheDocument();
expect(screen.getByRole("button")).toBeDisabled();
Expand All @@ -76,11 +77,12 @@ describe("Login", () => {

const emailInput = screen.getByTestId("register-email-input");
const passwordInput = screen.getByTestId("register-password-input");
await userEvent.type(emailInput, "[email protected]");

await userEvent.type(passwordInput, "P@ssw0rd");

await userEvent.click(screen.getByRole("button"));
await act(async () => {
await userEvent.type(emailInput, "[email protected]");
await userEvent.type(passwordInput, "P@ssw0rd");
await userEvent.click(screen.getByRole("button"));
});

expect(registerUserHandler).toBeCalledWith({
email: "[email protected]",
Expand Down
19 changes: 15 additions & 4 deletions apps/ui/test/tags.test.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
import { render, screen, waitFor, waitForElementToBeRemoved } from "@testing-library/react";
import {
act,
render,
screen,
waitFor,
waitForElementToBeRemoved,
} from "@testing-library/react";
import userEvent from "@testing-library/user-event";
import { SWRConfig } from "swr";
import { graphql } from "msw";
Expand Down Expand Up @@ -84,8 +90,10 @@ describe("Tags", () => {

render(<CreateTagForm />);

await user.type(screen.getByRole("textbox"), "Test Tag #2");
await user.click(screen.getByText("Submit"));
await act(async () => {
await user.type(screen.getByRole("textbox"), "Test Tag #2");
await user.click(screen.getByText("Submit"));
});

expect(createTagMockFn).toHaveBeenCalledWith("Test Tag #2");

Expand All @@ -105,7 +113,10 @@ describe("Tags", () => {

await waitForElementToBeRemoved(screen.getByRole("alert"));
expect(screen.getByRole("list")).toBeInTheDocument();
await user.click(screen.getAllByLabelText("Remove Tag")[0]);

await act(async () => {
await user.click(screen.getAllByLabelText("Remove Tag")[0]);
});

expect(removeTagMockFn).toHaveBeenCalledWith("1");
});
Expand Down
Loading

1 comment on commit 16d2277

@vercel
Copy link

@vercel vercel bot commented on 16d2277 Mar 5, 2023

Choose a reason for hiding this comment

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

Please sign in to comment.