Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: fe test setup #12

Merged
merged 16 commits into from
Aug 6, 2024
Merged

feat: fe test setup #12

merged 16 commits into from
Aug 6, 2024

Conversation

typeWolffo
Copy link
Member

No description provided.

@typeWolffo typeWolffo self-assigned this Jul 31, 2024
@typeWolffo typeWolffo marked this pull request as draft July 31, 2024 09:48
@typeWolffo typeWolffo force-pushed the jw/fe-test-setup branch 4 times, most recently from da14d7c to 7cb3f21 Compare August 2, 2024 10:40
@typeWolffo typeWolffo requested review from k1eu and mikoscz August 2, 2024 11:05
@typeWolffo typeWolffo marked this pull request as ready for review August 2, 2024 11:05
@typeWolffo typeWolffo changed the title WIP: fe test setup feat: fe test setup Aug 2, 2024
Comment on lines 12 to 25
vi.mock("../../../api/api-client");
vi.mock("@remix-run/react", async () => {
const module =
await vi.importActual<typeof import("@remix-run/react")>(
"@remix-run/react"
);
return {
...module,
useNavigate: () => mockedUseNavigate,
Link: ({ to, children }: PropsWithChildren<{ to: string }>) => (
<a href={to}>{children}</a>
),
};
});
Copy link
Member

Choose a reason for hiding this comment

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

can we move it to some method that we just fire in all the tests?

Comment on lines 47 to 49
ApiClient.auth.authControllerLogin.mockResolvedValue({
data: "",
});
Copy link
Member

Choose a reason for hiding this comment

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

we can have mock service worker running with the tests which would act as better mock solution

Copy link
Member

Choose a reason for hiding this comment

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

i think i'd keep the seed near the top of the api like in src folder - also we can explore if we want to break it down into smaller pieces like seedAdmin(), seedUsers(), seedFiles() wdyt @mikoscz ?

document.documentElement.classList.remove("dark");
})
.exhaustive();
if (typeof document !== "undefined") {
Copy link
Member

Choose a reason for hiding this comment

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

where document is not present?

"lint": "eslint --ignore-path .gitignore --cache --cache-location ./node_modules/.cache/eslint .",
"start": "cross-env NODE_ENV=production node ./server.js",
"generate:client": "swagger-typescript-api -p ../api/src/swagger/api-schema.json -o ./app/api --axios --name generated-api.ts --api-class-name API",
"typecheck": "tsc"
"typecheck": "tsc",
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
"typecheck": "tsc",
"tsc": "tsc --noEmit",

Copy link
Member

Choose a reason for hiding this comment

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

also you can add tsc-lint : tsc --noEmit && eslint command

Copy link
Member

Choose a reason for hiding this comment

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

I'd keep the tests next to components - without tests folder

@typeWolffo typeWolffo requested a review from k1eu August 6, 2024 11:15
Copy link
Member

@k1eu k1eu left a comment

Choose a reason for hiding this comment

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

fe ✅

@typeWolffo typeWolffo merged commit 6fd0cd5 into main Aug 6, 2024
@typeWolffo typeWolffo deleted the jw/fe-test-setup branch August 6, 2024 13:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants