Skip to content

Commit

Permalink
feat: test
Browse files Browse the repository at this point in the history
  • Loading branch information
RPDeshaies committed Sep 11, 2023
1 parent f24ebfc commit 2614507
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 10 deletions.
Binary file modified bun.lockb
Binary file not shown.
2 changes: 2 additions & 0 deletions bunfig.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[test]
preload = "./happydom.ts"
3 changes: 3 additions & 0 deletions happydom.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { GlobalRegistrator } from "@happy-dom/global-registrator";

GlobalRegistrator.register();
4 changes: 2 additions & 2 deletions lib/domains/character/CharacterFactory.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -660,7 +660,7 @@ describe("CharacterFactory.duplicate", () => {

const characterWithFakeIds = produce(defaultCharacter, (draft) => {
draft.id = "1";
draft.pages.forEach((p) => {
draft.pages?.forEach((p) => {
p.id = "1";
p.rows.forEach((r) => {
r.columns.forEach((c) => {
Expand All @@ -677,7 +677,7 @@ describe("CharacterFactory.duplicate", () => {

const duplicate = CharacterFactory.duplicate(characterWithFakeIds);
expect(duplicate.id).not.toBe("1");
duplicate.pages.forEach((p) => {
duplicate.pages?.forEach((p) => {
expect(p.id).not.toBe("1");
p.rows.forEach((r) => {
r.columns.forEach((c) => {
Expand Down
3 changes: 2 additions & 1 deletion lib/domains/character/CharacterFactory.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ export const CharacterFactory = {
resetAllIds(character: ICharacter): ICharacter {
return produce(character, (draft) => {
draft.id = Id.generate();
draft.pages.forEach((page) => {

draft.pages?.forEach((page) => {
page.id = Id.generate();
page.rows.forEach((row) => {
row.columns.forEach((col) => {
Expand Down
10 changes: 4 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@
"beta": "bun run build && bun run deploy:preview -- --alias beta",
"tsc": "tsc --project tsconfig.json --incremental --noEmit",
"lint": "eslint 'lib/**' --cache",
"test": "bun test watch",
"test:run": "bun test run",
"test:ui": "bun test watch --ui",
"test": "vitest",
"int": "bun run build && concurrently \"cypress run\" \"bun run serve:build\" --success first --kill-others --names \"cypress,server\" ",
"int:start": "concurrently \"cypress open\" \"bun run start\" --success first --kill-others --names \"cypress,server\" ",
"tsc-and-lint": "bun run tsc && bun run lint",
Expand Down Expand Up @@ -70,6 +68,7 @@
"uuid": "^9.0.0"
},
"devDependencies": {
"@happy-dom/global-registrator": "^11.0.2",
"@storybook/addon-essentials": "^7.3.1",
"@storybook/addon-interactions": "^7.3.1",
"@storybook/addon-links": "^7.3.1",
Expand All @@ -89,7 +88,7 @@
"@typescript-eslint/parser": "^6.3.0",
"@vitejs/plugin-legacy": "^4.1.1",
"@vitejs/plugin-react": "^4.0.4",
"@vitest/ui": "^0.34.1",
"bun-types": "^1.0.1",
"chromatic": "^6.21.0",
"concurrently": "^8.2.0",
"cypress": "^12.17.3",
Expand All @@ -106,8 +105,7 @@
"react-test-renderer": "^18.2.0",
"storybook": "^7.3.1",
"typescript": "^5.1.6",
"vite": "^4.4.9",
"vitest": "^0.34.1"
"vite": "^4.4.9"
},
"lint-staged": {
"*.{js,ts,tsx}": "eslint --cache --fix",
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"name": "typescript-tslint-plugin"
}
],
"types": ["vite/client", "vitest/globals"]
"types": ["bun-types", "vitest/globals"]
},
"include": ["lib/**/*", "stories/**/*"],
"exclude": ["node_modules", "cypress"]
Expand Down

0 comments on commit 2614507

Please sign in to comment.