Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 36ffe35dcd | |||
| 41be1ee73b | |||
| 0f8b17a1f6 |
@@ -0,0 +1,13 @@
|
||||
# Interview AI application-context lifetime
|
||||
|
||||
Baseline A3 `348f4684`, isolated branch codex/interview-ai-context at E:/Storage/Projects/Active/temp docs/jobjakt-local-build/next-security-patch. Source `0f8b17a`. Uses the qualified locked Next16.4.6/follow-redirects1.16.3 installation. No live model.
|
||||
|
||||
Three deterministic tests failed on original runtime source: a late generation displayed application7 text under application8; a completed suggestion remained available after changing application; a late accepted write called the former board loader again after navigation. Synthetic model/API responses only. The first two are also a risk of offering the wrong application's content for explicit application8 acceptance; no real misdirected write is claimed.
|
||||
|
||||
The sole assistant caller now keys its instance by jobId, scoping instructions, generated-language draft, errors, busy state and suggestions to that application instance. Existing CV reader cleanup remains. A layout-lifetime ref invalidates on committed unmount; an already accepted write can finish at its original target, but cannot invoke the old board-refresh callback afterward. No write is redirected, automatically retried or newly authorised. Current-application explicit accept/reject and normal refresh still use existing paths. UI language and generated-content language remain independent within the current application.
|
||||
|
||||
PASSED: final55 cases/two suites (51 InterviewPrep/four daily connected route cases), non-incremental TypeScript, scoped two-file lint and source diff. Three red failures are included in55;48 skipped cases in the focused red selection are not final-suite skips. An earlier successful run used a passive cleanup; final55 was rerun after using synchronous layout cleanup and is the qualification result. Existing generation, explicit acceptance, failed-add retry, answer drafts, CV retry and follow-up cases remain passing. [Receipts](evidence/interview-ai-context/SOURCE_RECEIPTS.json) bind final source and readable/native evidence.
|
||||
|
||||
PASSED: final standard Next16.4.6 build on exact new source after the55-case run; compile, TypeScript and static export completed exit0. No warning bypass. This is current isolated E-drive export evidence, not the older C-drive export and not a fresh browser run.
|
||||
|
||||
NOT RUN: fresh full frontend/backend regression, browser, native device/AT, actual model/semantic quality, provider, security/recovery/release qualification. Parent preparation/follow-up outstanding reads, broader job/session lifetime, AI live fallback copy and other components remain separate proof-required work; this is not whole-application isolation acceptance. Existing PDF metrics/visual acceptance not reopened. No catalogue/schema/renderer/ownership/revision/provider changes, orchestrator, main merge or production action.
|
||||
@@ -0,0 +1,61 @@
|
||||
{
|
||||
"baseline": "348f468478ed2fae1b6a52ff970471ea8ce54dd4",
|
||||
"sourceCommit": "0f8b17a",
|
||||
"sourceSha256Lf": {
|
||||
"job-tracker-ui/src/components/InterviewPrep.tsx": "e1c12d012d0488a8cee533015fff0944028578ca6ee37dd61fe70b60363a5803",
|
||||
"job-tracker-ui/src/interview-prep.test.tsx": "dfb23ea0682377a7edfe6af147f1046c90841e102ef35a2f62c6c85754058c97",
|
||||
"job-tracker-ui/package.json": "8b31e44c10b77b6d1e007af04c757c0577f12972ff3f6c7079bbc4c446a0d415",
|
||||
"job-tracker-ui/package-lock.json": "ac90fbdc79e2e0f23d54748814b41a03f5dcaf8fd27291b3dcb73b2603a83e72"
|
||||
},
|
||||
"nativeReceipts": [
|
||||
{
|
||||
"path": "interview-ai-context-red.json",
|
||||
"lfSha256": "cd1750809c6757251f0616417b85d206db07ce6b74c3a167bb6f3537c5a10c06",
|
||||
"rawSha256": "cd1750809c6757251f0616417b85d206db07ce6b74c3a167bb6f3537c5a10c06",
|
||||
"gzipSha256": "bf634ffd5cebf2f84df570c339cded3cd9e4fba247ccb71662572e9e1536c783",
|
||||
"nativeEncoding": "utf-8-sig"
|
||||
},
|
||||
{
|
||||
"path": "interview-ai-context-red.txt",
|
||||
"lfSha256": "a8673e1828567e5dcf97241f893c56178ba8cc09a90fbd9ed4a96e036527974c",
|
||||
"rawSha256": "999d08952b06ea3dd0b9021fcc6cd8263e069e24404a18242209ca9c1bf98ad3",
|
||||
"gzipSha256": "ab7bcecff278cce39f68ed4495cdbd0c827c31f5ccd515f5d12083d081ac4fd6",
|
||||
"nativeEncoding": "utf-16"
|
||||
},
|
||||
{
|
||||
"path": "interview-ai-context-final.json",
|
||||
"lfSha256": "3a24bbb550d5246f9dbb3fa28c6e5570c290263ba80714f6d1ffa7597a3496a8",
|
||||
"rawSha256": "3a24bbb550d5246f9dbb3fa28c6e5570c290263ba80714f6d1ffa7597a3496a8",
|
||||
"gzipSha256": "8b54fbfc88a68d714250d36a4cc41af046ecceb8f3b5cc51f06c858c0f307222",
|
||||
"nativeEncoding": "utf-8-sig"
|
||||
},
|
||||
{
|
||||
"path": "interview-ai-context-final.txt",
|
||||
"lfSha256": "a4b08a7b17361517ff242d01d15a2e31f974924adbab26ccf866efc45b886dd0",
|
||||
"rawSha256": "89dc7976226bf01bbd22702c18ea96ea3e821161c2c6fcb65949e6c2b514b924",
|
||||
"gzipSha256": "1905b14d96265a2a1fa2ab37f354e74e99569dd15401bd9dfac254fa8a969a14",
|
||||
"nativeEncoding": "utf-16"
|
||||
},
|
||||
{
|
||||
"path": "interview-ai-context-typecheck.txt",
|
||||
"lfSha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
|
||||
"rawSha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
|
||||
"gzipSha256": "46b50c321b39e89a491b6727a01628c34245605a30beb3e7414c5e01cff90e6e",
|
||||
"nativeEncoding": "utf-8-sig"
|
||||
},
|
||||
{
|
||||
"path": "interview-ai-context-lint.txt",
|
||||
"lfSha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
|
||||
"rawSha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
|
||||
"gzipSha256": "46b50c321b39e89a491b6727a01628c34245605a30beb3e7414c5e01cff90e6e",
|
||||
"nativeEncoding": "utf-8-sig"
|
||||
},
|
||||
{
|
||||
"path": "interview-ai-context-build.txt",
|
||||
"lfSha256": "2670468cf9011247d064dbd24366eeccc367597f86992c6129b60e00a1e7f3c1",
|
||||
"rawSha256": "87aa3a0631f4f36905c225ac05a5977045ff0c3735fda14eafbd5b6ffcab6b2a",
|
||||
"gzipSha256": "c9ec5fd2e55767fead726932919416886763c9e5fc75573415d7d3c1b3fc174b",
|
||||
"nativeEncoding": "utf-16"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
|
||||
> job-tracker-ui@0.1.0 build
|
||||
> node --max-old-space-size=4096 ./node_modules/next/dist/bin/next build
|
||||
|
||||
▲ Next.js 16.4.6 (Turbopack)
|
||||
✓ Running next.config.js took 49ms
|
||||
|
||||
Creating an optimized production build ...
|
||||
✓ Compiled successfully in 788ms
|
||||
Running TypeScript ...
|
||||
Finished TypeScript in 10.6s ...
|
||||
Collecting page data using 4 workers ...
|
||||
Generating static pages using 4 workers (0/3) ...
|
||||
✓ Generating static pages using 4 workers (3/3) in 1504ms
|
||||
Finalizing page optimization ...
|
||||
|
||||
Route (app)
|
||||
┌ ○ /
|
||||
└ ○ /_not-found
|
||||
|
||||
|
||||
○ (Static) prerendered as static content
|
||||
|
||||
Binary file not shown.
File diff suppressed because one or more lines are too long
BIN
Binary file not shown.
@@ -0,0 +1,13 @@
|
||||
node :
|
||||
At line:1 char:122
|
||||
+ ... =$env:TEMP; node node_modules/jest/bin/jest.js --runInBand --runTests ...
|
||||
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
+ CategoryInfo : NotSpecified: (:String) [], RemoteException
|
||||
+ FullyQualifiedErrorId : NativeCommandError
|
||||
|
||||
Test Suites: 2 passed, 2 total
|
||||
Tests: 55 passed, 55 total
|
||||
Snapshots: 0 total
|
||||
Time: 29.011 s
|
||||
Ran all test suites within paths "src/interview-prep.test.tsx", "src/daily-control-loop.test.tsx".
|
||||
Test results written to: ..\..\interview-ai-context-final.json
|
||||
Binary file not shown.
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
@@ -0,0 +1,361 @@
|
||||
node : console.error
|
||||
At line:1 char:122
|
||||
+ ... =$env:TEMP; node node_modules/jest/bin/jest.js --runInBand --runTests ...
|
||||
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
+ CategoryInfo : NotSpecified: ( console.error:String) [], RemoteException
|
||||
+ FullyQualifiedErrorId : NativeCommandError
|
||||
|
||||
An update to InterviewAiAssistant inside a test was not wrapped in act(...).
|
||||
|
||||
When testing, code that causes React state updates should be wrapped into act(...):
|
||||
|
||||
act(() => {
|
||||
/* fire events that update state */
|
||||
});
|
||||
/* assert on the output */
|
||||
|
||||
This ensures that you're testing the behavior the user would see in the browser. Learn more at
|
||||
https://react.dev/link/wrap-tests-with-act
|
||||
|
||||
233 | setCv(null); setCvLoading(true); setCvError(null);
|
||||
234 | applicationAssetsApi.cv(jobId)
|
||||
> 235 | .then((result) => { if (active) setCv(result); })
|
||||
| ^
|
||||
236 | .catch((cause) => { if (active) setCvError({ cause }); })
|
||||
237 | .finally(() => { if (active) setCvLoading(false); });
|
||||
238 | return () => { active = false; };
|
||||
|
||||
at node_modules/react-dom/cjs/react-dom-client.development.js:18758:19
|
||||
at runWithFiberInDEV (node_modules/react-dom/cjs/react-dom-client.development.js:874:13)
|
||||
at warnIfUpdatesNotWrappedWithActDEV (node_modules/react-dom/cjs/react-dom-client.development.js:18757:9)
|
||||
at scheduleUpdateOnFiber (node_modules/react-dom/cjs/react-dom-client.development.js:16409:11)
|
||||
at dispatchSetStateInternal (node_modules/react-dom/cjs/react-dom-client.development.js:9170:13)
|
||||
at dispatchSetState (node_modules/react-dom/cjs/react-dom-client.development.js:9127:7)
|
||||
at setCv (src/components/InterviewPrep.tsx:235:39)
|
||||
|
||||
console.error
|
||||
An update to ApplicationFollowUp inside a test was not wrapped in act(...).
|
||||
|
||||
When testing, code that causes React state updates should be wrapped into act(...):
|
||||
|
||||
act(() => {
|
||||
/* fire events that update state */
|
||||
});
|
||||
/* assert on the output */
|
||||
|
||||
This ensures that you're testing the behavior the user would see in the browser. Learn more at
|
||||
https://react.dev/link/wrap-tests-with-act
|
||||
|
||||
431 | try {
|
||||
432 | const result = await interviewPrepApi.followUp(jobId);
|
||||
> 433 | setData(result);
|
||||
| ^
|
||||
434 | setDate(result.followUpAt ? result.followUpAt.slice(0, 10) : "");
|
||||
435 | setAction(result.nextAction ?? "");
|
||||
436 | setError(null);
|
||||
|
||||
at node_modules/react-dom/cjs/react-dom-client.development.js:18758:19
|
||||
at runWithFiberInDEV (node_modules/react-dom/cjs/react-dom-client.development.js:874:13)
|
||||
at warnIfUpdatesNotWrappedWithActDEV (node_modules/react-dom/cjs/react-dom-client.development.js:18757:9)
|
||||
at scheduleUpdateOnFiber (node_modules/react-dom/cjs/react-dom-client.development.js:16409:11)
|
||||
at dispatchSetStateInternal (node_modules/react-dom/cjs/react-dom-client.development.js:9170:13)
|
||||
at dispatchSetState (node_modules/react-dom/cjs/react-dom-client.development.js:9127:7)
|
||||
at setData (src/components/InterviewPrep.tsx:433:7)
|
||||
|
||||
console.error
|
||||
An update to ApplicationFollowUp inside a test was not wrapped in act(...).
|
||||
|
||||
When testing, code that causes React state updates should be wrapped into act(...):
|
||||
|
||||
act(() => {
|
||||
/* fire events that update state */
|
||||
});
|
||||
/* assert on the output */
|
||||
|
||||
This ensures that you're testing the behavior the user would see in the browser. Learn more at
|
||||
https://react.dev/link/wrap-tests-with-act
|
||||
|
||||
432 | const result = await interviewPrepApi.followUp(jobId);
|
||||
433 | setData(result);
|
||||
> 434 | setDate(result.followUpAt ? result.followUpAt.slice(0, 10) : "");
|
||||
| ^
|
||||
435 | setAction(result.nextAction ?? "");
|
||||
436 | setError(null);
|
||||
437 | } catch (err) {
|
||||
|
||||
at node_modules/react-dom/cjs/react-dom-client.development.js:18758:19
|
||||
at runWithFiberInDEV (node_modules/react-dom/cjs/react-dom-client.development.js:874:13)
|
||||
at warnIfUpdatesNotWrappedWithActDEV (node_modules/react-dom/cjs/react-dom-client.development.js:18757:9)
|
||||
at scheduleUpdateOnFiber (node_modules/react-dom/cjs/react-dom-client.development.js:16409:11)
|
||||
at dispatchSetStateInternal (node_modules/react-dom/cjs/react-dom-client.development.js:9170:13)
|
||||
at dispatchSetState (node_modules/react-dom/cjs/react-dom-client.development.js:9127:7)
|
||||
at setDate (src/components/InterviewPrep.tsx:434:7)
|
||||
|
||||
console.error
|
||||
An update to ApplicationFollowUp inside a test was not wrapped in act(...).
|
||||
|
||||
When testing, code that causes React state updates should be wrapped into act(...):
|
||||
|
||||
act(() => {
|
||||
/* fire events that update state */
|
||||
});
|
||||
/* assert on the output */
|
||||
|
||||
This ensures that you're testing the behavior the user would see in the browser. Learn more at
|
||||
https://react.dev/link/wrap-tests-with-act
|
||||
|
||||
433 | setData(result);
|
||||
434 | setDate(result.followUpAt ? result.followUpAt.slice(0, 10) : "");
|
||||
> 435 | setAction(result.nextAction ?? "");
|
||||
| ^
|
||||
436 | setError(null);
|
||||
437 | } catch (err) {
|
||||
438 | setError({ cause: err, fallback: "interviewFollowUpLoadFailed" });
|
||||
|
||||
at node_modules/react-dom/cjs/react-dom-client.development.js:18758:19
|
||||
at runWithFiberInDEV (node_modules/react-dom/cjs/react-dom-client.development.js:874:13)
|
||||
at warnIfUpdatesNotWrappedWithActDEV (node_modules/react-dom/cjs/react-dom-client.development.js:18757:9)
|
||||
at scheduleUpdateOnFiber (node_modules/react-dom/cjs/react-dom-client.development.js:16409:11)
|
||||
at dispatchSetStateInternal (node_modules/react-dom/cjs/react-dom-client.development.js:9170:13)
|
||||
at dispatchSetState (node_modules/react-dom/cjs/react-dom-client.development.js:9127:7)
|
||||
at setAction (src/components/InterviewPrep.tsx:435:7)
|
||||
|
||||
console.error
|
||||
An update to ApplicationFollowUp inside a test was not wrapped in act(...).
|
||||
|
||||
When testing, code that causes React state updates should be wrapped into act(...):
|
||||
|
||||
act(() => {
|
||||
/* fire events that update state */
|
||||
});
|
||||
/* assert on the output */
|
||||
|
||||
This ensures that you're testing the behavior the user would see in the browser. Learn more at
|
||||
https://react.dev/link/wrap-tests-with-act
|
||||
|
||||
434 | setDate(result.followUpAt ? result.followUpAt.slice(0, 10) : "");
|
||||
435 | setAction(result.nextAction ?? "");
|
||||
> 436 | setError(null);
|
||||
| ^
|
||||
437 | } catch (err) {
|
||||
438 | setError({ cause: err, fallback: "interviewFollowUpLoadFailed" });
|
||||
439 | } finally {
|
||||
|
||||
at node_modules/react-dom/cjs/react-dom-client.development.js:18758:19
|
||||
at runWithFiberInDEV (node_modules/react-dom/cjs/react-dom-client.development.js:874:13)
|
||||
at warnIfUpdatesNotWrappedWithActDEV (node_modules/react-dom/cjs/react-dom-client.development.js:18757:9)
|
||||
at scheduleUpdateOnFiber (node_modules/react-dom/cjs/react-dom-client.development.js:16409:11)
|
||||
at dispatchSetStateInternal (node_modules/react-dom/cjs/react-dom-client.development.js:9170:13)
|
||||
at dispatchSetState (node_modules/react-dom/cjs/react-dom-client.development.js:9127:7)
|
||||
at setError (src/components/InterviewPrep.tsx:436:7)
|
||||
|
||||
console.error
|
||||
An update to ApplicationFollowUp inside a test was not wrapped in act(...).
|
||||
|
||||
When testing, code that causes React state updates should be wrapped into act(...):
|
||||
|
||||
act(() => {
|
||||
/* fire events that update state */
|
||||
});
|
||||
/* assert on the output */
|
||||
|
||||
This ensures that you're testing the behavior the user would see in the browser. Learn more at
|
||||
https://react.dev/link/wrap-tests-with-act
|
||||
|
||||
438 | setError({ cause: err, fallback: "interviewFollowUpLoadFailed" });
|
||||
439 | } finally {
|
||||
> 440 | setLoading(false);
|
||||
| ^
|
||||
441 | }
|
||||
442 | }, [jobId]);
|
||||
443 |
|
||||
|
||||
at node_modules/react-dom/cjs/react-dom-client.development.js:18758:19
|
||||
at runWithFiberInDEV (node_modules/react-dom/cjs/react-dom-client.development.js:874:13)
|
||||
at warnIfUpdatesNotWrappedWithActDEV (node_modules/react-dom/cjs/react-dom-client.development.js:18757:9)
|
||||
at scheduleUpdateOnFiber (node_modules/react-dom/cjs/react-dom-client.development.js:16409:11)
|
||||
at dispatchSetStateInternal (node_modules/react-dom/cjs/react-dom-client.development.js:9170:13)
|
||||
at dispatchSetState (node_modules/react-dom/cjs/react-dom-client.development.js:9127:7)
|
||||
at setLoading (src/components/InterviewPrep.tsx:440:7)
|
||||
|
||||
console.error
|
||||
An update to ApplicationInterviewPrep inside a test was not wrapped in act(...).
|
||||
|
||||
When testing, code that causes React state updates should be wrapped into act(...):
|
||||
|
||||
act(() => {
|
||||
/* fire events that update state */
|
||||
});
|
||||
/* assert on the output */
|
||||
|
||||
This ensures that you're testing the behavior the user would see in the browser. Learn more at
|
||||
https://react.dev/link/wrap-tests-with-act
|
||||
|
||||
55 | setLoading(true);
|
||||
56 | try {
|
||||
> 57 | setBoard(await interviewPrepApi.get(jobId));
|
||||
| ^
|
||||
58 | setError(null);
|
||||
59 | } catch (err) {
|
||||
60 | setError({ cause: err, fallback: "interviewPrepLoadFailed" });
|
||||
|
||||
at node_modules/react-dom/cjs/react-dom-client.development.js:18758:19
|
||||
at runWithFiberInDEV (node_modules/react-dom/cjs/react-dom-client.development.js:874:13)
|
||||
at warnIfUpdatesNotWrappedWithActDEV (node_modules/react-dom/cjs/react-dom-client.development.js:18757:9)
|
||||
at scheduleUpdateOnFiber (node_modules/react-dom/cjs/react-dom-client.development.js:16409:11)
|
||||
at dispatchSetStateInternal (node_modules/react-dom/cjs/react-dom-client.development.js:9170:13)
|
||||
at dispatchSetState (node_modules/react-dom/cjs/react-dom-client.development.js:9127:7)
|
||||
at setBoard (src/components/InterviewPrep.tsx:57:7)
|
||||
|
||||
console.error
|
||||
An update to ApplicationInterviewPrep inside a test was not wrapped in act(...).
|
||||
|
||||
When testing, code that causes React state updates should be wrapped into act(...):
|
||||
|
||||
act(() => {
|
||||
/* fire events that update state */
|
||||
});
|
||||
/* assert on the output */
|
||||
|
||||
This ensures that you're testing the behavior the user would see in the browser. Learn more at
|
||||
https://react.dev/link/wrap-tests-with-act
|
||||
|
||||
56 | try {
|
||||
57 | setBoard(await interviewPrepApi.get(jobId));
|
||||
> 58 | setError(null);
|
||||
| ^
|
||||
59 | } catch (err) {
|
||||
60 | setError({ cause: err, fallback: "interviewPrepLoadFailed" });
|
||||
61 | } finally {
|
||||
|
||||
at node_modules/react-dom/cjs/react-dom-client.development.js:18758:19
|
||||
at runWithFiberInDEV (node_modules/react-dom/cjs/react-dom-client.development.js:874:13)
|
||||
at warnIfUpdatesNotWrappedWithActDEV (node_modules/react-dom/cjs/react-dom-client.development.js:18757:9)
|
||||
at scheduleUpdateOnFiber (node_modules/react-dom/cjs/react-dom-client.development.js:16409:11)
|
||||
at dispatchSetStateInternal (node_modules/react-dom/cjs/react-dom-client.development.js:9170:13)
|
||||
at dispatchSetState (node_modules/react-dom/cjs/react-dom-client.development.js:9127:7)
|
||||
at setError (src/components/InterviewPrep.tsx:58:7)
|
||||
|
||||
console.error
|
||||
An update to ApplicationInterviewPrep inside a test was not wrapped in act(...).
|
||||
|
||||
When testing, code that causes React state updates should be wrapped into act(...):
|
||||
|
||||
act(() => {
|
||||
/* fire events that update state */
|
||||
});
|
||||
/* assert on the output */
|
||||
|
||||
This ensures that you're testing the behavior the user would see in the browser. Learn more at
|
||||
https://react.dev/link/wrap-tests-with-act
|
||||
|
||||
60 | setError({ cause: err, fallback: "interviewPrepLoadFailed" });
|
||||
61 | } finally {
|
||||
> 62 | setLoading(false);
|
||||
| ^
|
||||
63 | }
|
||||
64 | }, [jobId]);
|
||||
65 |
|
||||
|
||||
at node_modules/react-dom/cjs/react-dom-client.development.js:18758:19
|
||||
at runWithFiberInDEV (node_modules/react-dom/cjs/react-dom-client.development.js:874:13)
|
||||
at warnIfUpdatesNotWrappedWithActDEV (node_modules/react-dom/cjs/react-dom-client.development.js:18757:9)
|
||||
at scheduleUpdateOnFiber (node_modules/react-dom/cjs/react-dom-client.development.js:16409:11)
|
||||
at dispatchSetStateInternal (node_modules/react-dom/cjs/react-dom-client.development.js:9170:13)
|
||||
at dispatchSetState (node_modules/react-dom/cjs/react-dom-client.development.js:9127:7)
|
||||
at setLoading (src/components/InterviewPrep.tsx:62:7)
|
||||
|
||||
console.error
|
||||
An update to InterviewAiAssistant inside a test was not wrapped in act(...).
|
||||
|
||||
When testing, code that causes React state updates should be wrapped into act(...):
|
||||
|
||||
act(() => {
|
||||
/* fire events that update state */
|
||||
});
|
||||
/* assert on the output */
|
||||
|
||||
This ensures that you're testing the behavior the user would see in the browser. Learn more at
|
||||
https://react.dev/link/wrap-tests-with-act
|
||||
|
||||
235 | .then((result) => { if (active) setCv(result); })
|
||||
236 | .catch((cause) => { if (active) setCvError({ cause }); })
|
||||
> 237 | .finally(() => { if (active) setCvLoading(false); });
|
||||
| ^
|
||||
238 | return () => { active = false; };
|
||||
239 | }, [jobId, cvReadAttempt]);
|
||||
240 |
|
||||
|
||||
at node_modules/react-dom/cjs/react-dom-client.development.js:18758:19
|
||||
at runWithFiberInDEV (node_modules/react-dom/cjs/react-dom-client.development.js:874:13)
|
||||
at warnIfUpdatesNotWrappedWithActDEV (node_modules/react-dom/cjs/react-dom-client.development.js:18757:9)
|
||||
at scheduleUpdateOnFiber (node_modules/react-dom/cjs/react-dom-client.development.js:16409:11)
|
||||
at dispatchSetStateInternal (node_modules/react-dom/cjs/react-dom-client.development.js:9170:13)
|
||||
at dispatchSetState (node_modules/react-dom/cjs/react-dom-client.development.js:9127:7)
|
||||
at setCvLoading (src/components/InterviewPrep.tsx:237:36)
|
||||
|
||||
FAIL src/interview-prep.test.tsx (6.032 s)
|
||||
● late generation cannot offer another application the previous application suggestion
|
||||
|
||||
expect(element).not.toBeInTheDocument()
|
||||
|
||||
expected document not to contain element, found <p class="MuiTypography-root MuiTypography-body2
|
||||
css-1jpc1n5-MuiTypography-root">Only for application seven</p> instead
|
||||
|
||||
356 | await act(async () => finish({ data: { result: { text: 'Only for application seven' } } }));
|
||||
357 | const assistant = within(screen.getByRole('region', { name: translations.en.interviewAiTitle }));
|
||||
> 358 | expect(assistant.queryByText('Only for application seven')).not.toBeInTheDocument();
|
||||
| ^
|
||||
359 | expect(assistant.queryByRole('button', { name: translations.en.interviewAiAddToPrep
|
||||
})).not.toBeInTheDocument();
|
||||
360 | expect(assistant.getByLabelText(translations.en.coverAiAdditionalInstructions)).toHaveValue('');
|
||||
361 | expect(mockedApi.post).toHaveBeenCalledTimes(1);
|
||||
|
||||
at Object.toBeInTheDocument (src/interview-prep.test.tsx:358:67)
|
||||
|
||||
● completed AI suggestion is scoped to its application instead of becoming a new application draft
|
||||
|
||||
expect(element).not.toBeInTheDocument()
|
||||
|
||||
expected document not to contain element, found <p class="MuiTypography-root MuiTypography-body2
|
||||
css-1jpc1n5-MuiTypography-root">Prepared for application seven only</p> instead
|
||||
|
||||
371 | view.rerender(<I18nProvider><ConfirmProvider><ApplicationInterviewPrep jobId={8}
|
||||
/></ConfirmProvider></I18nProvider>);
|
||||
372 | const assistant = within(screen.getByRole('region', { name: translations.en.interviewAiTitle }));
|
||||
> 373 | expect(assistant.queryByText('Prepared for application seven only')).not.toBeInTheDocument();
|
||||
| ^
|
||||
374 | expect(assistant.queryByRole('button', { name: translations.en.interviewAiAddToPrep
|
||||
})).not.toBeInTheDocument();
|
||||
375 | expect(mockedApi.post).not.toHaveBeenCalledWith('/jobapplications/8/interview-prep', expect.anything());
|
||||
376 | });
|
||||
|
||||
at Object.toBeInTheDocument (src/interview-prep.test.tsx:373:76)
|
||||
|
||||
● late accepted suggestion does not reload the previous application board into the current application
|
||||
|
||||
expect(received).toHaveLength(expected)
|
||||
|
||||
Expected length: 1
|
||||
Received length: 2
|
||||
Received array: [["/jobapplications/7/interview-prep"], ["/jobapplications/7/interview-prep"]]
|
||||
|
||||
389 | await waitFor(() => expect(mockedApi.get).toHaveBeenCalledWith('/jobapplications/8/interview-prep'));
|
||||
390 | await act(async () => finish({ data: board.groups[0].items[0] }));
|
||||
> 391 | expect(mockedApi.get.mock.calls.filter(([url]) => url ===
|
||||
'/jobapplications/7/interview-prep')).toHaveLength(1);
|
||||
| ^
|
||||
392 | expect(mockedApi.get.mock.calls.filter(([url]) => url ===
|
||||
'/jobapplications/8/interview-prep')).toHaveLength(1);
|
||||
393 | expect(mockedApi.post.mock.calls[1]).toEqual(['/jobapplications/7/interview-prep',
|
||||
expect.objectContaining({ source: 'ai', content: 'Application seven suggestion' })]);
|
||||
394 | });
|
||||
|
||||
at Object.toHaveLength (src/interview-prep.test.tsx:391:99)
|
||||
|
||||
Test Suites: 1 failed, 1 total
|
||||
Tests: 3 failed, 48 skipped, 51 total
|
||||
Snapshots: 0 total
|
||||
Time: 7.657 s, estimated 24 s
|
||||
Ran all test suites within paths "src/interview-prep.test.tsx".
|
||||
Test results written to: ..\..\interview-ai-context-red.json
|
||||
Binary file not shown.
BIN
Binary file not shown.
@@ -1,4 +1,4 @@
|
||||
import React, { useCallback, useEffect, useState } from "react";
|
||||
import React, { useCallback, useEffect, useLayoutEffect, useRef, useState } from "react";
|
||||
|
||||
import {
|
||||
Alert, Box, Button, Checkbox, Chip, IconButton, LinearProgress, MenuItem, Paper,
|
||||
@@ -199,7 +199,7 @@ export function ApplicationInterviewPrep({ jobId }: { jobId: number }) {
|
||||
</Stack>
|
||||
</Shell>
|
||||
|
||||
<InterviewAiAssistant jobId={jobId} onAccepted={load} />
|
||||
<InterviewAiAssistant key={jobId} jobId={jobId} onAccepted={load} />
|
||||
|
||||
<ApplicationFollowUp jobId={jobId} />
|
||||
</Stack>
|
||||
@@ -215,6 +215,11 @@ const INTERVIEW_AI_FOCUS = [
|
||||
] as const;
|
||||
|
||||
function InterviewAiAssistant({ jobId, onAccepted }: { jobId: number; onAccepted: () => void }) {
|
||||
const active = useRef(true);
|
||||
useLayoutEffect(() => {
|
||||
active.current = true;
|
||||
return () => { active.current = false; };
|
||||
}, []);
|
||||
const { canUseAi } = useAccountPlan();
|
||||
const { language: uiLanguage, t } = useI18n();
|
||||
const [cv, setCv] = useState<ApplicationCv | null>(null);
|
||||
@@ -272,6 +277,7 @@ function InterviewAiAssistant({ jobId, onAccepted }: { jobId: number; onAccepted
|
||||
content: suggestion,
|
||||
source: "ai",
|
||||
});
|
||||
if (!active.current) return;
|
||||
setSuggestion("");
|
||||
onAccepted();
|
||||
} catch (err) {
|
||||
|
||||
@@ -343,6 +343,56 @@ test("AI preparation uses the linked CV and only saves after explicit acceptance
|
||||
));
|
||||
});
|
||||
|
||||
test('late generation cannot offer another application the previous application suggestion', async () => {
|
||||
mockedApi.get.mockReset(); routeGet();
|
||||
let finish!: (value: any) => void;
|
||||
mockedApi.post.mockReset().mockReturnValueOnce(new Promise(resolve => { finish = resolve; }) as any);
|
||||
const view = render(<ApplicationInterviewPrep jobId={7} />);
|
||||
await screen.findByText('Backend CV');
|
||||
fireEvent.change(screen.getByLabelText(translations.en.coverAiAdditionalInstructions), { target: { value: 'Private instructions for application seven' } });
|
||||
fireEvent.click(screen.getByRole('button', { name: translations.en.interviewAiGenerate }));
|
||||
await waitFor(() => expect(mockedApi.post).toHaveBeenCalledTimes(1));
|
||||
view.rerender(<I18nProvider><ConfirmProvider><ApplicationInterviewPrep jobId={8} /></ConfirmProvider></I18nProvider>);
|
||||
await act(async () => finish({ data: { result: { text: 'Only for application seven' } } }));
|
||||
const assistant = within(screen.getByRole('region', { name: translations.en.interviewAiTitle }));
|
||||
expect(assistant.queryByText('Only for application seven')).not.toBeInTheDocument();
|
||||
expect(assistant.queryByRole('button', { name: translations.en.interviewAiAddToPrep })).not.toBeInTheDocument();
|
||||
expect(assistant.getByLabelText(translations.en.coverAiAdditionalInstructions)).toHaveValue('');
|
||||
expect(mockedApi.post).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
test('completed AI suggestion is scoped to its application instead of becoming a new application draft', async () => {
|
||||
mockedApi.get.mockReset(); routeGet();
|
||||
mockedApi.post.mockReset().mockResolvedValue({ data: { result: { text: 'Prepared for application seven only' } } } as any);
|
||||
const view = render(<ApplicationInterviewPrep jobId={7} />);
|
||||
await screen.findByText('Backend CV');
|
||||
fireEvent.click(screen.getByRole('button', { name: translations.en.interviewAiGenerate }));
|
||||
expect(await screen.findByText('Prepared for application seven only')).toBeVisible();
|
||||
view.rerender(<I18nProvider><ConfirmProvider><ApplicationInterviewPrep jobId={8} /></ConfirmProvider></I18nProvider>);
|
||||
const assistant = within(screen.getByRole('region', { name: translations.en.interviewAiTitle }));
|
||||
expect(assistant.queryByText('Prepared for application seven only')).not.toBeInTheDocument();
|
||||
expect(assistant.queryByRole('button', { name: translations.en.interviewAiAddToPrep })).not.toBeInTheDocument();
|
||||
expect(mockedApi.post).not.toHaveBeenCalledWith('/jobapplications/8/interview-prep', expect.anything());
|
||||
});
|
||||
|
||||
test('late accepted suggestion does not reload the previous application board into the current application', async () => {
|
||||
mockedApi.get.mockReset(); routeGet();
|
||||
let finish!: (value: any) => void;
|
||||
mockedApi.post.mockReset().mockResolvedValueOnce({ data: { result: { text: 'Application seven suggestion' } } } as any).mockReturnValueOnce(new Promise(resolve => { finish = resolve; }) as any);
|
||||
const view = render(<ApplicationInterviewPrep jobId={7} />);
|
||||
await screen.findByText('Backend CV');
|
||||
fireEvent.click(screen.getByRole('button', { name: translations.en.interviewAiGenerate }));
|
||||
await screen.findByText('Application seven suggestion');
|
||||
fireEvent.click(screen.getByRole('button', { name: translations.en.interviewAiAddToPrep }));
|
||||
await waitFor(() => expect(mockedApi.post).toHaveBeenCalledTimes(2));
|
||||
view.rerender(<I18nProvider><ConfirmProvider><ApplicationInterviewPrep jobId={8} /></ConfirmProvider></I18nProvider>);
|
||||
await waitFor(() => expect(mockedApi.get).toHaveBeenCalledWith('/jobapplications/8/interview-prep'));
|
||||
await act(async () => finish({ data: board.groups[0].items[0] }));
|
||||
expect(mockedApi.get.mock.calls.filter(([url]) => url === '/jobapplications/7/interview-prep')).toHaveLength(1);
|
||||
expect(mockedApi.get.mock.calls.filter(([url]) => url === '/jobapplications/8/interview-prep')).toHaveLength(1);
|
||||
expect(mockedApi.post.mock.calls[1]).toEqual(['/jobapplications/7/interview-prep', expect.objectContaining({ source: 'ai', content: 'Application seven suggestion' })]);
|
||||
});
|
||||
|
||||
test.each(['en', 'nb'] as const)('pending linked CV is loading, not an empty selection (%s)', async language => {
|
||||
localStorage.setItem('uiLanguage', language);
|
||||
mockedApi.get.mockReset(); routeGet();
|
||||
|
||||
Reference in New Issue
Block a user