Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
407 commits
Select commit Hold shift + click to select a range
e253224
test(client): wrap team distribution interactions in act
apalchys Sep 11, 2026
26d2d75
test(client): wrap CV contact interactions in act
apalchys Sep 11, 2026
aa5d8f7
test(client): wrap task submission interactions in act
apalchys Sep 11, 2026
d0948a1
test(client): wrap event modal interactions in act
apalchys Sep 11, 2026
f14a922
test(client): wrap criteria interactions in act
apalchys Sep 11, 2026
20eeb08
test(client): wrap education card interactions in act
apalchys Sep 11, 2026
47a1c76
test(client): wrap about card interactions in act
apalchys Sep 11, 2026
0bda433
test(client): wrap message panel interactions in act
apalchys Sep 11, 2026
fe03739
test(client): wrap tasks page interactions in act
apalchys Sep 11, 2026
e3e100b
test(client): wrap editable criteria updates in act
apalchys Sep 11, 2026
4732b95
test(client): wrap join team interactions in act
apalchys Sep 11, 2026
ad5161b
test(client): wrap discipline modal interactions in act
apalchys Sep 11, 2026
b7f2f72
test(client): wrap question list interactions in act
apalchys Sep 11, 2026
061fc42
test(client): wrap obfuscation modal interactions in act
apalchys Sep 11, 2026
a3237be
test(client): wrap course event interactions in act
apalchys Sep 11, 2026
c80fb23
test(client): consolidate languages card scenarios
apalchys Sep 12, 2026
a12b776
test(client): consolidate interview summary scenarios
apalchys Sep 12, 2026
49b43a8
test(client): consolidate student info scenarios
apalchys Sep 12, 2026
45e0428
test(client): consolidate mentors hall scenarios
apalchys Sep 12, 2026
55d4af4
test(client): consolidate profile settings modal scenarios
apalchys Sep 12, 2026
e3444f3
test(client): consolidate student stats modal scenarios
apalchys Sep 12, 2026
b36204c
test(client): consolidate legacy feedback scenarios
apalchys Sep 12, 2026
a26d8be
test(client): consolidate additional action scenarios
apalchys Sep 12, 2026
a55b336
test(client): consolidate cross-check history scenarios
apalchys Sep 12, 2026
b2f23f6
test(client): consolidate score table tab scenarios
apalchys Sep 12, 2026
cd26204
test(client): consolidate stage feedback scenarios
apalchys Sep 12, 2026
7672893
test(client): consolidate expired CV tooltip scenarios
apalchys Sep 12, 2026
bafdcd3
test(client): consolidate timezone settings scenarios
apalchys Sep 12, 2026
71e0421
test(client): consolidate welcome card assertions
apalchys Sep 12, 2026
a951bc4
test(client): consolidate mentor preference scenarios
apalchys Sep 12, 2026
1892ffb
test(client): consolidate course task select scenarios
apalchys Sep 12, 2026
118e91c
test(client): consolidate mentor endorsement scenarios
apalchys Sep 12, 2026
241665a
test(client): consolidate CV action scenarios
apalchys Sep 12, 2026
3a75a32
test(client): consolidate table column scenarios
apalchys Sep 12, 2026
1ab7f97
test(client): consolidate mentor deletion scenarios
apalchys Sep 12, 2026
6e57589
test(client): consolidate team distribution actions
apalchys Sep 12, 2026
560ee2a
test(client): consolidate editable criteria scenarios
apalchys Sep 12, 2026
885655d
test(client): consolidate column search scenarios
apalchys Sep 12, 2026
76809b4
test(client): consolidate instruction rendering scenarios
apalchys Sep 12, 2026
2a278f1
test(client): consolidate auto test task assertions
apalchys Sep 12, 2026
9a38bc9
test(client): consolidate footer assertions
apalchys Sep 12, 2026
fe361be
test(client): consolidate cross-check pairs table states
apalchys Sep 12, 2026
7e67b5e
test(client): consolidate bad review table states
apalchys Sep 12, 2026
822cdd4
test(client): consolidate attempt answer assertions
apalchys Sep 12, 2026
f3d4ba1
test(client): consolidate heroes badge scenarios
apalchys Sep 12, 2026
0e40704
test(client): consolidate task settings assertions
apalchys Sep 12, 2026
490aa0f
test(client): consolidate certificate modal states
apalchys Sep 12, 2026
1f37f05
test(client): consolidate mentor dashboard states
apalchys Sep 12, 2026
1070e5c
test(client): consolidate mentor search assertions
apalchys Sep 12, 2026
f970b35
test(client): consolidate task stats interactions
apalchys Sep 12, 2026
8365a40
test(client): consolidate subtask criteria scenarios
apalchys Sep 12, 2026
684893b
test(client): consolidate mentor card variants
apalchys Sep 12, 2026
a654cb8
test(client): consolidate GDPR checkbox flow
apalchys Sep 12, 2026
f648962
test(client): consolidate public feedback modal states
apalchys Sep 12, 2026
c58c452
test(client): consolidate language selector scenarios
apalchys Sep 12, 2026
eb63895
test(client): update public feedback modal snapshot
apalchys Sep 12, 2026
0c5e5ee
test(client): consolidate theme switch scenarios
apalchys Sep 12, 2026
e548fe5
test(client): consolidate public feedback card scenarios
apalchys Sep 12, 2026
96d214f
test(client): consolidate notification settings table states
apalchys Sep 12, 2026
1366f0c
test(client): consolidate course task selector assertions
apalchys Sep 12, 2026
dc71a0c
test(client): remove obsolete feedback card snapshots
apalchys Sep 12, 2026
fab7956
test(client): consolidate location selector scenarios
apalchys Sep 12, 2026
a3ceb28
test(client): consolidate notebook upload flow
apalchys Sep 12, 2026
8860d30
test(client): consolidate score widget values
apalchys Sep 12, 2026
0bab663
test(client): consolidate dev tools container flow
apalchys Sep 12, 2026
f884ec8
test(client): consolidate review settings flow
apalchys Sep 12, 2026
3d1c753
test(client): consolidate settings drawer flow
apalchys Sep 12, 2026
ab1bd8f
test(client): consolidate auto test task card states
apalchys Sep 12, 2026
9c252a7
test(client): consolidate data processing checkbox flow
apalchys Sep 12, 2026
cd450b9
test(client): consolidate team welcome card states
apalchys Sep 12, 2026
fb8ad22
test(client): consolidate person selector scenarios
apalchys Sep 12, 2026
c7dd2c2
test(client): consolidate criteria deletion flow
apalchys Sep 12, 2026
b7c4318
test(client): consolidate student assignment modal flow
apalchys Sep 12, 2026
d3320f7
test(client): consolidate CV course section states
apalchys Sep 12, 2026
0804e23
test(client): consolidate GitHub panel validation
apalchys Sep 12, 2026
9e55972
test(client): consolidate no-course states
apalchys Sep 12, 2026
5d73da6
test(client): consolidate mentor resend modal flow
apalchys Sep 12, 2026
ca12bef
test(client): consolidate tag color settings flow
apalchys Sep 12, 2026
0d650cb
test(client): consolidate filtered tag scenarios
apalchys Sep 12, 2026
5c000c1
test(client): consolidate interview student info variants
apalchys Sep 12, 2026
74e6cee
test(client): consolidate footer social links
apalchys Sep 12, 2026
d1419b2
test(client): consolidate interview card states
apalchys Sep 12, 2026
4ef9289
test(client): consolidate home summary states
apalchys Sep 12, 2026
6dec960
test(client): consolidate page layout states
apalchys Sep 12, 2026
0ce9f57
test(client): consolidate task stats modal states
apalchys Sep 12, 2026
49c5129
test(client): consolidate table renderer variants
apalchys Sep 12, 2026
394d1aa
test(client): consolidate cross-check message states
apalchys Sep 12, 2026
bd1bd1a
test(client): consolidate next event card assertions
apalchys Sep 12, 2026
c70448a
test(client): consolidate prescreening feedback assertions
apalchys Sep 12, 2026
f35f9a6
test(client): consolidate mentor data hook flows
apalchys Sep 12, 2026
86e7c08
test(client): consolidate course task verification flows
apalchys Sep 12, 2026
7f908ac
test(client): consolidate mentor stats modal flow
apalchys Sep 12, 2026
e292f1b
test(client): streamline header banner carousel cases
apalchys Sep 12, 2026
1486fdf
test(client): consolidate mentoring language assertions
apalchys Sep 12, 2026
034cda7
test(client): consolidate preference assertions
apalchys Sep 12, 2026
6d8e434
test(client): consolidate JSON attributes flow
apalchys Sep 12, 2026
708b29a
test(client): consolidate criteria action flows
apalchys Sep 12, 2026
aa329ec
test(client): consolidate admin sider interactions
apalchys Sep 12, 2026
2b2c278
test(client): consolidate done section variants
apalchys Sep 12, 2026
5106199
test(client): consolidate task description states
apalchys Sep 12, 2026
1b21e57
test(client): consolidate feedback section states
apalchys Sep 12, 2026
7748b2c
test(client): consolidate filtered tag flows
apalchys Sep 12, 2026
fb26985
test(client): consolidate mentor info states
apalchys Sep 12, 2026
b876e7f
test(client): consolidate criteria type selection
apalchys Sep 12, 2026
ca5eacc
test(client): consolidate mobile schedule item states
apalchys Sep 12, 2026
10d4e49
test(client): consolidate task status tab states
apalchys Sep 12, 2026
a477625
test(client): consolidate tooltiped button states
apalchys Sep 12, 2026
110d561
test(client): consolidate distribution card title states
apalchys Sep 12, 2026
66d9346
test(client): consolidate course detail assertions
apalchys Sep 12, 2026
2ddf911
test(client): consolidate settings item flows
apalchys Sep 12, 2026
20d54d3
test(client): consolidate Discord card states
apalchys Sep 12, 2026
aff7b22
test(client): consolidate gratitude list states
apalchys Sep 12, 2026
9753d69
test(client): consolidate criteria modal flows
apalchys Sep 12, 2026
2c65366
test(client): consolidate session access flows
apalchys Sep 12, 2026
cb2cec3
test(client): consolidate status tab flows
apalchys Sep 12, 2026
b86ebee
test(client): consolidate mentor countries card assertions
apalchys Sep 12, 2026
96a1612
test(client): consolidate certificate countries assertions
apalchys Sep 12, 2026
17eb700
test(client): consolidate visible course states
apalchys Sep 12, 2026
aaa925a
test(client): consolidate interview subheader states
apalchys Sep 12, 2026
18876df
test(client): consolidate penalty criteria flows
apalchys Sep 12, 2026
86635ea
test(client): consolidate course access assertions
apalchys Sep 12, 2026
07a4657
test(client): consolidate available review states
apalchys Sep 12, 2026
a16e1c5
test(client): consolidate contact list flows
apalchys Sep 12, 2026
f6abe95
test(client): consolidate consent states
apalchys Sep 12, 2026
74d8816
test(client): consolidate discipline states
apalchys Sep 12, 2026
1a40052
test(client): consolidate course selector flow
apalchys Sep 12, 2026
fa9511f
test(client): consolidate custom popconfirm flows
apalchys Sep 12, 2026
be828d3
test(client): consolidate theme provider flows
apalchys Sep 12, 2026
fc4a7fc
test(client): consolidate registry footer assertions
apalchys Sep 12, 2026
49bc908
test(client): consolidate footer menu states
apalchys Sep 12, 2026
23e6cf1
test(client): consolidate public link flow
apalchys Sep 12, 2026
c423fd9
test(client): reuse interviewer widget render
apalchys Sep 12, 2026
643561a
test(client): reuse student discord render
apalchys Sep 12, 2026
c66e028
test(client): streamline random task interactions
apalchys Sep 12, 2026
3c37dfe
test(client): group coding assertions by task type
apalchys Sep 12, 2026
c01bffe
test(client): reuse main stats card render
apalchys Sep 12, 2026
66e6541
test(client): stub devtools presentation components
apalchys Sep 12, 2026
9cc5ed6
test(client): reuse course item render
apalchys Sep 12, 2026
5ad801a
test(client): reuse editable cross-check cell render
apalchys Sep 12, 2026
43f18fb
test(client): consolidate footer help assertions
apalchys Sep 12, 2026
3022e0a
test(client): reuse cross-check assignment render
apalchys Sep 12, 2026
daa74a5
test(client): streamline interviews list flow
apalchys Sep 12, 2026
305a372
test(client): reuse criteria upload render
apalchys Sep 12, 2026
fe03033
test(client): reuse registration layout render
apalchys Sep 12, 2026
75f92b4
test(client): stub course statistics presentation
apalchys Sep 12, 2026
0b7b505
test(client): streamline system alerts coverage
apalchys Sep 12, 2026
06065a1
test(client): consolidate tasks chart assertions
apalchys Sep 12, 2026
2cc5b15
test(client): streamline cross-check criteria states
apalchys Sep 12, 2026
0f1ad58
test(client): streamline donation component test
apalchys Sep 12, 2026
fcae95d
test(client): reuse course links render
apalchys Sep 12, 2026
702a70a
test(client): streamline wait list alert flow
apalchys Sep 12, 2026
11f62d0
test(client): streamline interview helper rendering
apalchys Sep 12, 2026
b3ac81d
test(client): streamline form card variants
apalchys Sep 12, 2026
c027f69
test(client): streamline students countries card
apalchys Sep 12, 2026
249fcf7
test(client): reuse clipboard button render
apalchys Sep 12, 2026
0c606eb
test(client): streamline date widget states
apalchys Sep 12, 2026
b949701
test(client): streamline registration notice flow
apalchys Sep 12, 2026
3930e99
test(client): group username variants
apalchys Sep 12, 2026
7d39e62
test(client): reuse dashboard card render
apalchys Sep 12, 2026
a6b9eab
test(client): reuse registry header render
apalchys Sep 12, 2026
c8cafae
test(client): consolidate clipboard button behavior
apalchys Sep 12, 2026
5b3a2eb
test(client): stub no-access page presentation
apalchys Sep 12, 2026
10b9838
test(client): consolidate student registry branches
apalchys Sep 12, 2026
831f535
test(client): consolidate github user link variants
apalchys Sep 12, 2026
bbd57ea
test(client): streamline github user link behavior
apalchys Sep 12, 2026
642da07
test(client): reuse rating render
apalchys Sep 12, 2026
7abd0ec
test(client): streamline score page branches
apalchys Sep 12, 2026
5e37367
test(client): streamline statistics scope selector
apalchys Sep 12, 2026
cb6ceed
test(client): streamline CV about section
apalchys Sep 12, 2026
59ca3b2
test(client): streamline CSV export button
apalchys Sep 12, 2026
a410365
test(client): reuse count badge render
apalchys Sep 12, 2026
d8bfb06
test(client): consolidate CV view states
apalchys Sep 12, 2026
249c2ce
test(client): group task deadline variants
apalchys Sep 12, 2026
6e6409b
test(client): consolidate list component states
apalchys Sep 12, 2026
10b4a79
test(client): reuse interview extra info render
apalchys Sep 12, 2026
955c69a
test(client): consolidate footer feedback assertions
apalchys Sep 12, 2026
9f77146
test(client): consolidate connection confirmation assertions
apalchys Sep 12, 2026
18266f1
test(client): streamline students stats card
apalchys Sep 12, 2026
549ad04
test(client): streamline loading screen states
apalchys Sep 12, 2026
1bbea70
test(client): streamline email confirmation flow
apalchys Sep 12, 2026
7dc095a
test(client): consolidate rating label states
apalchys Sep 12, 2026
63d788f
test(client): consolidate list item meta states
apalchys Sep 12, 2026
ab39ab3
test(client): reuse criteria upload render
apalchys Sep 12, 2026
39cdb89
test(client): reuse drag table render
apalchys Sep 12, 2026
fd6e5bf
test(client): streamline expand button interaction
apalchys Sep 12, 2026
cf59ffa
test(client): reuse registry banner render
apalchys Sep 12, 2026
019f390
test(client): isolate title criteria presentation
apalchys Sep 12, 2026
d6df389
test(client): streamline certificate alert states
apalchys Sep 12, 2026
8acd6d2
test(client): consolidate person cell states
apalchys Sep 12, 2026
101e6b3
test(client): combine no submission assertions
apalchys Sep 12, 2026
18fabef
test(client): flush expelled stats requests directly
apalchys Sep 12, 2026
778b971
test(client): combine update alert assertions
apalchys Sep 12, 2026
5dd67b8
test(client): streamline submitted status states
apalchys Sep 12, 2026
13f18f4
test(client): isolate no courses presentation
apalchys Sep 12, 2026
b9a6030
test(client): streamline team distribution renderers
apalchys Sep 12, 2026
1402ff0
test(client): streamline profile expand button
apalchys Sep 12, 2026
84a365a
test(client): streamline task card column values
apalchys Sep 12, 2026
ac05428
test(client): group prepared comment states
apalchys Sep 12, 2026
62549e2
test(client): replace common card snapshots
apalchys Sep 12, 2026
ecfc353
test(client): reuse opportunity avatar render
apalchys Sep 12, 2026
2488a20
test(client): reuse base section render
apalchys Sep 12, 2026
a02be5c
test(client): group schedule renderer outputs
apalchys Sep 12, 2026
4bc2935
test(client): streamline epam mentor stats card
apalchys Sep 12, 2026
5aad63a
test(client): flush dashboard data requests directly
apalchys Sep 12, 2026
30edc6b
test(client): streamline certificate stats card
apalchys Sep 12, 2026
450582b
test(client): flush resume requests directly
apalchys Sep 12, 2026
955106c
test(client): streamline certification eligibility card
apalchys Sep 12, 2026
4bb3650
test(client): reuse solution review avatar render
apalchys Sep 12, 2026
c445ba7
test(client): streamline score card states
apalchys Sep 12, 2026
311852f
test(client): streamline JSON export states
apalchys Sep 12, 2026
489f08f
test(client): streamline score widget values
apalchys Sep 12, 2026
98c0ffc
test(client): reuse date widget render
apalchys Sep 12, 2026
3552482
test(client): streamline interviewer layouts
apalchys Sep 12, 2026
a3d5ff8
test(client): streamline tab counter renderers
apalchys Sep 12, 2026
bad7cb3
test(client): reuse score selector render
apalchys Sep 12, 2026
8f5f744
test(client): reuse student discord render
apalchys Sep 12, 2026
9a57dd2
test(client): consolidate github avatar states
apalchys Sep 12, 2026
1d6a68d
test(client): streamline list item props
apalchys Sep 12, 2026
a10bda5
test(client): reuse sloth image render
apalchys Sep 12, 2026
8787f1f
test(client): consolidate warning states
apalchys Sep 12, 2026
c124ce7
test(client): reuse public resume page render
apalchys Sep 12, 2026
e80112e
test(client): streamline mentor stats card
apalchys Sep 12, 2026
b0fdf53
test(client): streamline candidate widget states
apalchys Sep 12, 2026
ea3992a
test(client): reuse donut chart render
apalchys Sep 12, 2026
c56e7a5
test(client): consolidate comment states
apalchys Sep 12, 2026
302f62b
test(client): reuse liquid chart render
apalchys Sep 12, 2026
f463abf
test(client): combine message provider checks
apalchys Sep 12, 2026
69a6b73
test(client): replace student summary polling
apalchys Sep 12, 2026
255bae6
test(client): reuse course label render
apalchys Sep 12, 2026
5a78525
test(client): wrap timer cleanup in act
apalchys Sep 12, 2026
1b498a8
test(client): remove duplicate maps render
apalchys Sep 12, 2026
bba154f
test(client): reuse personal section render
apalchys Sep 12, 2026
82c593d
test(client): reuse dev tools provider render
apalchys Sep 12, 2026
321cfb4
test(client): remove answers polling
apalchys Sep 12, 2026
a86df31
test(client): reuse interview details render
apalchys Sep 12, 2026
1a07007
test(client): reuse contacts section render
apalchys Sep 12, 2026
012a6a9
test(client): reuse mentor registry render
apalchys Sep 12, 2026
6713d82
test(client): reuse course stats hook render
apalchys Sep 12, 2026
96ece2c
test(client): remove duplicate places hook renders
apalchys Sep 12, 2026
eb628c2
test(client): replace view data polling
apalchys Sep 12, 2026
73c2e30
test(client): reuse modal form hook render
apalchys Sep 12, 2026
da94ff6
test(client): reuse team score hook renders
apalchys Sep 12, 2026
7e9df9c
test(client): reuse active course hook render
apalchys Sep 12, 2026
4663264
test(client): call expiration helper directly
apalchys Sep 12, 2026
2157f54
style(client): format education card test
apalchys Sep 12, 2026
df20222
style(client): format events admin test
apalchys Sep 12, 2026
0d95228
style(client): format places hook test
apalchys Sep 12, 2026
8dc6b88
test(nestjs): fix strict typing in test fixtures and mocks
apalchys Sep 12, 2026
c553061
test(client): reduce unit test warnings
apalchys Sep 12, 2026
d9859c4
Merge branch 'master' into feature/optimize-tests
AlreadyBored Sep 12, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
.sentryclirc
.swc/
.turbo
.vitest/
.vscode
app/
coverage
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
### Prerequisites

- [Git 2.10+](https://git-scm.com/downloads)
- [NodeJS LTS](https://nodejs.org/en/)
- [Node.js 24 LTS](https://nodejs.org/en/) (also used in CI)
- [Podman](https://podman.io/docs/installation)
- [podman-compose](https://github.com/containers/podman-compose)

Expand Down
236 changes: 0 additions & 236 deletions VITEST.md

This file was deleted.

21 changes: 21 additions & 0 deletions client/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,27 @@ modules/<Feature>/
- Convert styled-jsx to CSS modules during touch-based changes.
- Do not initiate large-scale rewrites without approval.

## Unit Tests

- Run all client tests: `npm test --workspace client`
- Run tests with combined coverage: `npm run test:ci --workspace client`
- Run DOM-free tests: `npm test --workspace client -- --project node`
- Run component and browser API tests: `npm test --workspace client -- --project dom`

The `nodeTests` list in `vitest.config.mts` selects audited DOM-free tests. Add a file only if its tests and runtime
imports work without browser globals. All other tests use jsdom and `setupTests.ts`. Both projects retain file isolation
and contribute to the same coverage report and thresholds.

Retries are disabled so flaky tests fail on their first attempt. Fix the async wait or state cleanup before adding a
test-specific retry. When checking one rendered state, group related assertions in one test to avoid repeated UI renders.
Keep separate tests for different inputs and interactions.

For a timing comparison, use the same worker count and coverage options before and after the change:

```sh
npm run test:ci --workspace client -- --maxWorkers=4
```

## Enforcement (Planned)

- ESLint boundary rules to prevent cross-module imports.
Expand Down
8 changes: 4 additions & 4 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,15 @@
},
"devDependencies": {
"@playwright/test": "^1.51.1",
"@testing-library/jest-dom": "6.1.4",
"@testing-library/react": "14.1.2",
"@testing-library/user-event": "14.5.1",
"@testing-library/dom": "10.4.1",
"@testing-library/jest-dom": "7.0.1",
"@testing-library/react": "16.3.3",
"@testing-library/user-event": "14.6.7",
"@types/aws-lambda": "8.10.126",
"@types/cookie": "0.5.4",
"@types/react": "18.3.18",
"@types/react-dom": "18.3.5",
"eslint-plugin-testing-library": "7.16.0",
"jsdom": "^29.0.2",
"mq-polyfill": "1.1.8"
},
"nextBundleAnalysis": {
Expand Down
25 changes: 25 additions & 0 deletions client/src/__tests__/setupUser.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { act } from '@testing-library/react';
import userEvent from '@testing-library/user-event';

type User = ReturnType<typeof userEvent.setup>;

export function setupUser(...options: Parameters<typeof userEvent.setup>): User {
const user = userEvent.setup(...options);

return new Proxy(user, {
get(target, property, receiver) {
const value = Reflect.get(target, property, receiver);
if (typeof value !== 'function') {
return value;
}

return async (...args: unknown[]) => {
let result: unknown;
await act(async () => {
result = await Reflect.apply(value, target, args);
});
return result;
};
},
});
}
20 changes: 6 additions & 14 deletions client/src/components/Comment.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { render, screen } from '@testing-library/react';
import { Comment } from './Comment';

describe('Comment', () => {
it('renders author, datetime, content and children', () => {
render(
it('renders populated and omitted comment sections', () => {
const { container, rerender } = render(
<Comment
author="John Doe"
avatar={<span data-testid="avatar">A</span>}
Expand All @@ -19,30 +19,22 @@ describe('Comment', () => {
expect(screen.getByText('This is the comment body')).toBeInTheDocument();
expect(screen.getByText('Nested reply')).toBeInTheDocument();
expect(screen.getByTestId('avatar')).toBeInTheDocument();
});

it('does not render the avatar when not provided', () => {
render(<Comment content="No avatar here" />);
rerender(<Comment content="No avatar here" />);

expect(screen.queryByTestId('avatar')).not.toBeInTheDocument();
expect(screen.getByText('No avatar here')).toBeInTheDocument();
});

it('omits the header row when neither author nor datetime are provided', () => {
render(<Comment content="Only content" />);
rerender(<Comment content="Only content" />);

expect(screen.getByText('Only content')).toBeInTheDocument();
expect(screen.queryByText('2 hours ago')).not.toBeInTheDocument();
});

it('renders the header row when only datetime is provided', () => {
render(<Comment datetime="just now" />);
rerender(<Comment datetime="just now" />);

expect(screen.getByText('just now')).toBeInTheDocument();
});

it('renders nothing in the body areas when content and children are absent', () => {
const { container } = render(<Comment author="Solo Author" />);
rerender(<Comment author="Solo Author" />);

expect(screen.getByText('Solo Author')).toBeInTheDocument();
// only the wrapper + author header should be present, no content/children divs
Expand Down
Loading
Loading