Compare commits
2 Commits
master
...
make-tests
| Author | SHA1 | Date |
|---|---|---|
|
|
0dbfc356d5 | |
|
|
b46d1748ba |
|
|
@ -0,0 +1,40 @@
|
||||||
|
import { act, render, screen, waitFor } from '@testing-library/react'
|
||||||
|
|
||||||
|
import { createRemixStub, RemixStubProps } from "@remix-run/testing"
|
||||||
|
import App from './root'
|
||||||
|
let RemixStub: (props: RemixStubProps) => React.JSX.Element
|
||||||
|
|
||||||
|
describe("root", () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
RemixStub = createRemixStub([
|
||||||
|
{
|
||||||
|
path: "/",
|
||||||
|
meta: () => ([]),
|
||||||
|
links: () => ([]),
|
||||||
|
Component: App
|
||||||
|
}
|
||||||
|
])
|
||||||
|
})
|
||||||
|
|
||||||
|
describe("when user is on iOS", () => {
|
||||||
|
describe("version 16.4 or higher", () => {
|
||||||
|
describe("and tack up now is not already installed on their device", () => {
|
||||||
|
test("they are instructed to install tack up now", async () => {
|
||||||
|
// render(<RemixStub/>)
|
||||||
|
let x: number = 4
|
||||||
|
// await waitFor(() => screen.findByText<HTMLElement>("Whoah"))
|
||||||
|
console.log("YES HI")
|
||||||
|
|
||||||
|
expect(true).toBe(true)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
// describe("and tack up now is already installed on their device", () => {
|
||||||
|
// describe("and they are not in standalone mode", () => {
|
||||||
|
|
||||||
|
// })
|
||||||
|
// })
|
||||||
|
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
@ -5,6 +5,7 @@ import {
|
||||||
Scripts,
|
Scripts,
|
||||||
ScrollRestoration,
|
ScrollRestoration,
|
||||||
} from "@remix-run/react";
|
} from "@remix-run/react";
|
||||||
|
import React, { useEffect, useRef, useState } from "react";
|
||||||
|
|
||||||
export function Layout({ children }: { children: React.ReactNode }) {
|
export function Layout({ children }: { children: React.ReactNode }) {
|
||||||
return (
|
return (
|
||||||
|
|
@ -27,3 +28,5 @@ export function Layout({ children }: { children: React.ReactNode }) {
|
||||||
export default function App() {
|
export default function App() {
|
||||||
return <Outlet />;
|
return <Outlet />;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
() => Promise<Json<{ contacts: Contact[]}>>
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
module.exports = {
|
||||||
|
presets: [
|
||||||
|
['@babel/preset-env', { targets: { node: 'current' } }],
|
||||||
|
'@babel/preset-typescript',
|
||||||
|
["@babel/preset-react", {
|
||||||
|
"runtime": "automatic"
|
||||||
|
}]
|
||||||
|
],
|
||||||
|
}
|
||||||
|
|
@ -6,7 +6,7 @@ services:
|
||||||
database:
|
database:
|
||||||
image: postgres
|
image: postgres
|
||||||
ports:
|
ports:
|
||||||
- "0.0.0.0:5433:5432"
|
- "5433:5432"
|
||||||
environment:
|
environment:
|
||||||
POSTGRES_PASSWORD: $POSTGRES_PASSWORD
|
POSTGRES_PASSWORD: $POSTGRES_PASSWORD
|
||||||
POSTGRES_USER: postgres
|
POSTGRES_USER: postgres
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
import type {Config} from 'jest';
|
||||||
|
|
||||||
|
const config: Config = {
|
||||||
|
verbose: true,
|
||||||
|
testPathIgnorePatterns: ["/node_modules/", "data/"],
|
||||||
|
watchPathIgnorePatterns: [
|
||||||
|
"data"
|
||||||
|
],
|
||||||
|
preset: "ts-jest",
|
||||||
|
testEnvironment: "jest-environment-jsdom",
|
||||||
|
transform: {
|
||||||
|
// '^.+\\.ts?$': 'ts-jest',
|
||||||
|
// '^.+\\.tsx?$': 'ts-jest',
|
||||||
|
'^.+\\.[t|j]s?$': 'babel-jest',
|
||||||
|
'^.+\\.[t|j]sx?$': 'babel-jest',
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export default config;
|
||||||
File diff suppressed because it is too large
Load Diff
25
package.json
25
package.json
|
|
@ -6,12 +6,13 @@
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "remix vite:build",
|
"build": "remix vite:build",
|
||||||
"dev": "remix vite:dev",
|
"dev": "remix vite:dev",
|
||||||
"lint": "eslint --ignore-path .gitignore --cache --cache-location ./node_modules/.cache/eslint .",
|
"lint": "eslint --ignore-path .gitignore --cache --cache-location ./node_modules/.cache/eslint . --ext .ts,.tsx,.js,.jsx",
|
||||||
"start": "remix-serve ./build/server/index.js",
|
"start": "remix-serve ./build/server/index.js",
|
||||||
"typecheck": "tsc",
|
"typecheck": "tsc",
|
||||||
"test": "jest --watch"
|
"test": "jest --watch --config=jest.config.ts"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@eslint/js": "^9.3.0",
|
||||||
"@remix-run/express": "^2.9.1",
|
"@remix-run/express": "^2.9.1",
|
||||||
"@remix-run/node": "^2.9.0",
|
"@remix-run/node": "^2.9.0",
|
||||||
"@remix-run/react": "^2.9.0",
|
"@remix-run/react": "^2.9.0",
|
||||||
|
|
@ -23,15 +24,22 @@
|
||||||
"react-dom": "^18.2.0"
|
"react-dom": "^18.2.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@babel/core": "^7.24.5",
|
||||||
|
"@babel/preset-env": "^7.24.5",
|
||||||
|
"@babel/preset-react": "^7.24.1",
|
||||||
|
"@babel/preset-typescript": "^7.24.1",
|
||||||
"@remix-run/dev": "^2.9.0",
|
"@remix-run/dev": "^2.9.0",
|
||||||
"@remix-run/testing": "^2.9.1",
|
"@remix-run/testing": "^2.9.1",
|
||||||
|
"@testing-library/jest-dom": "^6.4.5",
|
||||||
"@testing-library/react": "^15.0.4",
|
"@testing-library/react": "^15.0.4",
|
||||||
"@types/express": "^4.17.21",
|
"@types/express": "^4.17.21",
|
||||||
|
"@types/jest": "^29.5.12",
|
||||||
"@types/react": "^18.2.20",
|
"@types/react": "^18.2.20",
|
||||||
"@types/react-dom": "^18.2.7",
|
"@types/react-dom": "^18.2.7",
|
||||||
"@types/supertest": "^6.0.2",
|
"@types/supertest": "^6.0.2",
|
||||||
"@typescript-eslint/eslint-plugin": "^6.7.4",
|
"@typescript-eslint/eslint-plugin": "^6.7.4",
|
||||||
"@typescript-eslint/parser": "^6.7.4",
|
"@typescript-eslint/parser": "^6.7.4",
|
||||||
|
"babel-jest": "^29.7.0",
|
||||||
"chai": "^4.4.1",
|
"chai": "^4.4.1",
|
||||||
"chai-as-promised": "^7.1.1",
|
"chai-as-promised": "^7.1.1",
|
||||||
"eslint": "^8.38.0",
|
"eslint": "^8.38.0",
|
||||||
|
|
@ -41,15 +49,28 @@
|
||||||
"eslint-plugin-react": "^7.33.2",
|
"eslint-plugin-react": "^7.33.2",
|
||||||
"eslint-plugin-react-hooks": "^4.6.0",
|
"eslint-plugin-react-hooks": "^4.6.0",
|
||||||
"jest": "^29.7.0",
|
"jest": "^29.7.0",
|
||||||
|
"jest-environment-jsdom": "^29.7.0",
|
||||||
"sinon": "^17.0.1",
|
"sinon": "^17.0.1",
|
||||||
"sinon-chai": "^3.7.0",
|
"sinon-chai": "^3.7.0",
|
||||||
"supertest": "^7.0.0",
|
"supertest": "^7.0.0",
|
||||||
|
"ts-jest": "^29.1.4",
|
||||||
"ts-node": "^10.9.2",
|
"ts-node": "^10.9.2",
|
||||||
"typescript": "^5.1.6",
|
"typescript": "^5.1.6",
|
||||||
|
"typescript-eslint": "^7.11.0",
|
||||||
"vite": "^5.1.0",
|
"vite": "^5.1.0",
|
||||||
"vite-tsconfig-paths": "^4.2.1"
|
"vite-tsconfig-paths": "^4.2.1"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18.0.0"
|
"node": ">=18.0.0"
|
||||||
|
},
|
||||||
|
"eslintConfig": {
|
||||||
|
"parser": "@typescript-eslint/parser",
|
||||||
|
"plugins": [
|
||||||
|
"@typescript-eslint"
|
||||||
|
],
|
||||||
|
"parserOptions": {
|
||||||
|
"ecmaVersion": 6,
|
||||||
|
"sourceType": "module"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,6 @@
|
||||||
|
// jest-dom adds custom jest matchers for asserting on DOM nodes.
|
||||||
|
// allows you to do things like:
|
||||||
|
// expect(element).toHaveTextContent(/react/i)
|
||||||
|
// learn more: https://github.com/testing-library/jest-dom
|
||||||
|
import 'react'
|
||||||
|
import '@testing-library/jest-dom'
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
],
|
],
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"lib": ["DOM", "DOM.Iterable", "ES2022"],
|
"lib": ["DOM", "DOM.Iterable", "ES2022"],
|
||||||
"types": ["@remix-run/node", "vite/client"],
|
"types": ["@remix-run/jsdom", "@remix-run/node", "vite/client", "jest", "node"],
|
||||||
"isolatedModules": true,
|
"isolatedModules": true,
|
||||||
"esModuleInterop": true,
|
"esModuleInterop": true,
|
||||||
"jsx": "react-jsx",
|
"jsx": "react-jsx",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue