docs(attachments): qualify bounded action lifetime guards

This commit is contained in:
cesnimda
2026-11-17 07:37:23 +01:00
parent e93f194281
commit 745ec3ea86
20 changed files with 887 additions and 0 deletions
@@ -0,0 +1,9 @@
# Attachment rename/delete lifetime
17 November 2026. Source `e93f1942` on `codex/a3-ui-10`, based on published CV evidence `48634aaf`.
Rename/delete capture existing session context plus mounted application generation. They check again after confirmation/prompt and the mutation response, before feedback and refresh. Old confirmations cannot issue writes after unmount, job change or session invalidation. Completed server work is not reversed. Current-language success/failure copy comes from the existing translation ref. Payloads, trim/no-change rules, file ownership endpoints and confirmations are retained.
Ten original regressions FAILED: six obsolete-decision writes and four delayed wrong-language outcomes. Final49 cases/four suites PASSED; earlier41 overlaps49. Eight added late-response/unmount/job-change cases passed, but were not part of the original red run. Project TypeScript, scoped ESLint, diff check and AST update PASSED (19,285 nodes/47,413 edges). Source/native gzip evidence in `evidence/attachment-action/`.
No real file mutation or session switch was performed; tests use real UI providers and mocked API/session boundaries. Backend tenant/security, native/browser/device, full attachment and final phase acceptance remain open. Initial and post-mutation list reads can still replace a changed application; six separately reproduced follow-up cases remain outside this source commit. Other upload/metadata/download/preview lifetimes remain unqualified. Rollback: revert this bounded source commit, no data migration.
@@ -0,0 +1,74 @@
{
"sourceCommit": "e93f194281dda2888a37e0d6113bd35dc3c06b30",
"sourcesLfSha256": {
"job-tracker-ui/src/attachment-action-lifetime.test.tsx": "9ccac0a07641237d7d70e2a262b0d1b1f85a146c827974503cdb0bb6816dc9c9",
"job-tracker-ui/src/components/Attachments.tsx": "d3ee749dc31fd42bed3d262f74f6264e2e648d7f8928e69c0b4d9169e6caa44b"
},
"evidenceLfSha256": {
"red.json": "5b912ba7416d8016e3ac9c7b46ca4e40143b077c1e2fa4baca70737221ef7faf",
"red.txt": "a0a994912b058ffc7dec48e85b1924cb62aa0331da246868d13793cff924329d",
"green.json": "e0a539d187980eaded1a3be5835a419b714f78bb135387dcc29f1951ba1b3d8f",
"green.txt": "9ef85e39dbd1bc8bb560f112e225221d39e59655aeedda49ded572b164a21d2f",
"final.json": "535ab183d6497f7a57a2e5a840f513b4c00ad622c112def6a64abd507d5729ce",
"final.txt": "05ba250a711e21b6c4455c8b444be7d325c6c469dbee8d5a490f303379d927b1",
"typecheck.txt": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
"lint.txt": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
"graph.txt": "54b506fd5f3d471cc732d00c9292551cc70ba8f96e55ed1973c1a4f4b1c090d4"
},
"nativeReceipts": [
{
"path": "red.json",
"gzipPath": "red.json.gz",
"rawSha256": "5b912ba7416d8016e3ac9c7b46ca4e40143b077c1e2fa4baca70737221ef7faf",
"gzipSha256": "f9c044d319f6cd84fa6e4cdbf0c99e53f62ff38b3917e96f8fb0f629c92811ba"
},
{
"path": "red.txt",
"gzipPath": "red.txt.gz",
"rawSha256": "8fe911cf6c91e27d9da23295fa82b08cb6f6968e3cbf7c3eb3e81f13e9d402cc",
"gzipSha256": "2726bea35b13bb9f7787f28927586ba8a87f6d56546d12f3a8daed7817fe5319"
},
{
"path": "green.json",
"gzipPath": "green.json.gz",
"rawSha256": "e0a539d187980eaded1a3be5835a419b714f78bb135387dcc29f1951ba1b3d8f",
"gzipSha256": "3853cb7665fdc5793b1d33a851b5161ed563bee8668457c4ba4fdbe9f117d469"
},
{
"path": "green.txt",
"gzipPath": "green.txt.gz",
"rawSha256": "ca84dc3d9a9f5abb50bafe3a096f992d9a365aaec9a3edd6e663d586a1e9c81a",
"gzipSha256": "5786805ffc33fe9039a21353b6386b5180de81315192680ab6c47408cf199f44"
},
{
"path": "final.json",
"gzipPath": "final.json.gz",
"rawSha256": "535ab183d6497f7a57a2e5a840f513b4c00ad622c112def6a64abd507d5729ce",
"gzipSha256": "74533606fa1c23a9a5f4a56b7baf65d737081daec5a9a62c103a783b741595d7"
},
{
"path": "final.txt",
"gzipPath": "final.txt.gz",
"rawSha256": "6726b4b77ddb64e86fc401aa2f2d800955334b5856457f001f1c87c87e33170f",
"gzipSha256": "cd3165ea7a6870fe48510185d7221ccf42fa606d291edeb7df07bb72e9d229d7"
},
{
"path": "typecheck.txt",
"gzipPath": "typecheck.txt.gz",
"rawSha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
"gzipSha256": "46b50c321b39e89a491b6727a01628c34245605a30beb3e7414c5e01cff90e6e"
},
{
"path": "lint.txt",
"gzipPath": "lint.txt.gz",
"rawSha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
"gzipSha256": "46b50c321b39e89a491b6727a01628c34245605a30beb3e7414c5e01cff90e6e"
},
{
"path": "graph.txt",
"gzipPath": "graph.txt.gz",
"rawSha256": "7c6f3c8da6703b9c4aae3c13676be789c990540f91869c87c69d91e94f26809a",
"gzipSha256": "aa8641e92e8042afa4998d4840b34652f997f8e625f1fc2e187a0f44b81f9638"
}
]
}
File diff suppressed because one or more lines are too long
@@ -0,0 +1,7 @@
Test Suites: 4 passed, 4 total
Tests: 49 passed, 49 total
Snapshots: 0 total
Time: 15.973 s
Ran all test suites matching src/attachment-action-lifetime.test.tsx|src/attachments.test.tsx|src/dialog-text.test.tsx|src/file-picker-activation.test.tsx.
Test results written to: E:\Storage\Projects\Active\temp docs\jobjakt-local-build\attachment-action-final.json
@@ -0,0 +1,18 @@
Re-extracting code files in . (no LLM needed)...
[graphify watch] 583 file(s) not classified (no supported extension or shebang), skipped: .dockerignore, .env.example, .git, .gitattributes, .gitignore, 1440-en-dark-converted.gz (+577 more)
AST cache: 2542/2990 files served from cache (85%); 448 to extract
AST extraction: 100/448 uncached files (22%) [16 workers]
AST extraction: 200/448 uncached files (44%) [16 workers]
AST extraction: 300/448 uncached files (66%) [16 workers]
AST extraction: 400/448 uncached files (89%) [16 workers]
AST extraction: 448/448 uncached files (100%) [16 workers]
warning: 8 .sql file(s) contributed nothing to the graph because a dependency is missing: tree_sitter_sql not installed. Install it with: pip install "graphifyy[sql]" (#1745)
warning: 144 code file(s) yielded no symbols (0.14 MB) — a data file, or source this extractor models no symbols for: JobTrackerApi.Tests/PdfBrowserStub/Program.cs, JobTrackerApi/Program.cs, JobTrackerApi/Properties/AssemblyInfo.cs, browser-extension/tests/capture-url.test.mjs, docs/audits/2026-09-07/validation/evidence/b05-excel-probe.ps1 (+139 more)
[graphify watch] community set changed since labeling (0 saved labels, 1189 communities now; renamed 149 community(ies) by their hub). Run `graphify label` to refresh names with the LLM.
Graph has 19285 nodes (above 5000 limit). Building aggregated community view...
graph.html written (aggregated: 1189 community nodes, 3122 cross-community edges)
Tip: run with --obsidian for full node-level detail.
[graphify watch] Rebuilt: 19285 nodes, 47413 edges, 1189 communities
[graphify watch] graph.json, graph.html and GRAPH_REPORT.md updated in graphify-out
Code graph updated. For doc/paper/image changes run /graphify --update in your AI assistant.
Tip: set GEMINI_API_KEY or GOOGLE_API_KEY to use Gemini for semantic extraction.
File diff suppressed because one or more lines are too long
@@ -0,0 +1,7 @@
Test Suites: 4 passed, 4 total
Tests: 41 passed, 41 total
Snapshots: 0 total
Time: 14.107 s
Ran all test suites matching src/attachment-action-lifetime.test.tsx|src/attachments.test.tsx|src/dialog-text.test.tsx|src/file-picker-activation.test.tsx.
Test results written to: E:\Storage\Projects\Active\temp docs\jobjakt-local-build\attachment-action-green.json
File diff suppressed because one or more lines are too long
@@ -0,0 +1,769 @@
FAIL src/attachment-action-lifetime.test.tsx (21.156 s)
● attachment rename decision after unmount cannot mutate the previous context
expect(jest.fn()).not.toHaveBeenCalled()
Expected number of calls: 0
Received number of calls: 1
1: "/attachments/7", {"fileName": "New name.pdf"}
57 | fireEvent.click(within(dialog).getByRole("button", { name: action === "rename" ? "Rename" : "Delete" }));
58 | await act(async () => undefined);
> 59 | expect(mockedApi.patch).not.toHaveBeenCalled();
| ^
60 | expect(mockedApi.delete).not.toHaveBeenCalled();
61 | expect(mockedApi.get).toHaveBeenCalledTimes(reads);
62 | });
at toHaveBeenCalled (src/attachment-action-lifetime.test.tsx:59:31)
● attachment rename decision after job change cannot mutate the previous context
expect(jest.fn()).not.toHaveBeenCalled()
Expected number of calls: 0
Received number of calls: 1
1: "/attachments/7", {"fileName": "New name.pdf"}
57 | fireEvent.click(within(dialog).getByRole("button", { name: action === "rename" ? "Rename" : "Delete" }));
58 | await act(async () => undefined);
> 59 | expect(mockedApi.patch).not.toHaveBeenCalled();
| ^
60 | expect(mockedApi.delete).not.toHaveBeenCalled();
61 | expect(mockedApi.get).toHaveBeenCalledTimes(reads);
62 | });
at toHaveBeenCalled (src/attachment-action-lifetime.test.tsx:59:31)
● attachment rename decision after session cannot mutate the previous context
expect(jest.fn()).not.toHaveBeenCalled()
Expected number of calls: 0
Received number of calls: 1
1: "/attachments/7", {"fileName": "New name.pdf"}
57 | fireEvent.click(within(dialog).getByRole("button", { name: action === "rename" ? "Rename" : "Delete" }));
58 | await act(async () => undefined);
> 59 | expect(mockedApi.patch).not.toHaveBeenCalled();
| ^
60 | expect(mockedApi.delete).not.toHaveBeenCalled();
61 | expect(mockedApi.get).toHaveBeenCalledTimes(reads);
62 | });
at toHaveBeenCalled (src/attachment-action-lifetime.test.tsx:59:31)
● attachment delete decision after unmount cannot mutate the previous context
expect(jest.fn()).not.toHaveBeenCalled()
Expected number of calls: 0
Received number of calls: 1
1: "/attachments/7"
58 | await act(async () => undefined);
59 | expect(mockedApi.patch).not.toHaveBeenCalled();
> 60 | expect(mockedApi.delete).not.toHaveBeenCalled();
| ^
61 | expect(mockedApi.get).toHaveBeenCalledTimes(reads);
62 | });
63 | test.each([
at toHaveBeenCalled (src/attachment-action-lifetime.test.tsx:60:32)
● attachment delete decision after job change cannot mutate the previous context
expect(jest.fn()).not.toHaveBeenCalled()
Expected number of calls: 0
Received number of calls: 1
1: "/attachments/7"
58 | await act(async () => undefined);
59 | expect(mockedApi.patch).not.toHaveBeenCalled();
> 60 | expect(mockedApi.delete).not.toHaveBeenCalled();
| ^
61 | expect(mockedApi.get).toHaveBeenCalledTimes(reads);
62 | });
63 | test.each([
at toHaveBeenCalled (src/attachment-action-lifetime.test.tsx:60:32)
● attachment delete decision after session cannot mutate the previous context
expect(jest.fn()).not.toHaveBeenCalled()
Expected number of calls: 0
Received number of calls: 1
1: "/attachments/7"
58 | await act(async () => undefined);
59 | expect(mockedApi.patch).not.toHaveBeenCalled();
> 60 | expect(mockedApi.delete).not.toHaveBeenCalled();
| ^
61 | expect(mockedApi.get).toHaveBeenCalledTimes(reads);
62 | });
63 | test.each([
at toHaveBeenCalled (src/attachment-action-lifetime.test.tsx:60:32)
● attachment rename delayed resolve uses current language
Unable to find an element with the text: Gi nytt navn fullført.. This could be because the text is broken up by multiple elements. In this case, you can provide a function for your text matcher to make your matcher more flexible.
Ignored nodes: comments, script, style
<body
style=""
>
<div>
<div
class="MuiBox-root css-0"
>
<div
class="MuiBox-root css-1owejxv"
>
<div
class="MuiBox-root css-0"
>
<p
class="MuiTypography-root MuiTypography-body1 css-1v8ok63-MuiTypography-root"
>
Vedlegg (1)
</p>
<p
class="MuiTypography-root MuiTypography-body2 css-1qf9eb3-MuiTypography-root"
>
Last opp CV-er, søknadsbrev, porteføljer og støttedokumenter for denne søknaden.
</p>
<div
class="MuiBox-root css-x2j9i8"
>
<div
class="MuiChip-root MuiChip-outlined MuiChip-sizeSmall MuiChip-colorDefault MuiChip-outlinedDefault css-1w2bku1-MuiChip-root"
>
<span
class="MuiChip-label MuiChip-labelSmall css-19m61dl-MuiChip-label"
>
0 bilder
</span>
</div>
<div
class="MuiChip-root MuiChip-outlined MuiChip-sizeSmall MuiChip-colorDefault MuiChip-outlinedDefault css-1w2bku1-MuiChip-root"
>
<span
class="MuiChip-label MuiChip-labelSmall css-19m61dl-MuiChip-label"
>
1 PDF-er
</span>
</div>
<div
class="MuiChip-root MuiChip-outlined MuiChip-sizeSmall MuiChip-colorDefault MuiChip-outlinedDefault css-1w2bku1-MuiChip-root"
>
<span
class="MuiChip-label MuiChip-labelSmall css-19m61dl-MuiChip-label"
>
Maks 10 MB hver
</span>
</div>
</div>
</div>
<button
class="MuiButtonBase-root MuiButton-root MuiButton-outlined MuiButton-outlinedPrimary MuiButton-sizeSmall MuiButton-outlinedSizeSmall MuiButton-colorPrimary MuiButton-root MuiButton-outlined MuiButton-outlinedPrimary MuiButton-sizeSmall MuiButton-outlinedSizeSmall MuiButton-colorPrimary css-74b9is-MuiButtonBase-root-MuiButton-root"
tabindex="0"
type="button"
>
<span
class="MuiButton-icon MuiButton-startIcon MuiButton-iconSizeSmall css-d8i980-MuiButton-startIcon"
>
<svg
aria-hidden="true"
class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium css-1umw9bq-MuiSvgIcon-root"
data-testid="CloudUploadOutlinedIcon"
focusable="false"
viewBox="0 0 24 24"
>
<path
d="M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96M19 18H6c-2.21 0-4-1.79-4-4 0-2.05 1.53-3.76 3.56-3.97l1.07-.11.5-.95C8.08 7.14 9.94 6 12 6c2.62 0 4.88 1.86 5.39 4.43l.3 1.5 1.53.11c1.56.1 2.78 1.41 2.78 2.96 0 1.65-1.35 3-3 3M8 13h2.55v3h2.9v-3H16l-4-4z"
/>
</svg>
</span>
Last opp
</button>
<input
hidden=""
multiple=""
type="file"
/>
</div>
<div
class="MuiBox-root css-497k9w"
>
<p
class="MuiTypography-root MuiTypography-body1 css-1g7ym63-MuiTypography-root"
>
Dra og slipp filer her
</p>
<p
class="MuiTypography-root MuiTypography-body2 css-1moljxt-MuiTypography-root"
>
eller bruk opplastingsknappen for å velge dokumenter fra enheten din.
</p>
</div>
<span
aria-atomic="true"
aria-live="polite"
class="MuiBox-root css-ty8jgw"
role="status"
>
Innhold lastet.
</span>
<div
aria-label="Vedlegg (1)"
class="MuiTableContainer-root css-1sde01b-MuiTableContainer-root"
role="region"
tabindex="0"
>
<table
aria-label="Gjeldende dokumenter"
class="MuiTable-root css-1ii7ygr-MuiTable-root"
>
<thead
class="MuiTableHead-root css-1a7iywq-MuiTableHead-root"
>
<tr
class="MuiTableRow-root MuiTableRow-head css-1xtozoh-MuiTableRow-root"
>
<th
class="MuiTableCell-root MuiTableCell-head MuiTableCell-sizeSmall css-10umtgd-MuiTableCell-root"
scope="col"
>
Navn
</th>
<th
class="MuiTableCell-root MuiTableCell-head MuiTableCell-sizeSmall css-vgdc2f-MuiTableCell-root"
scope="col"
>
Type
</th>
<th
class="MuiTableCell-root MuiTableCell-head MuiTableCell-sizeSmall css-by61h7-MuiTableCell-root"
scope="col"
>
Filtype
</th>
<th
class="MuiTableCell-root MuiTableCell-head MuiTableCell-sizeSmall css-1vxk39h-MuiTableCell-root"
scope="col"
>
...
74 | await act(async () => { if (outcome === "resolve") pending.resolve({ data: {} }); else pending.reject(new Error("synthetic write failure")); });
75 | const key = action === "rename" ? outcome === "resolve" ? "attachmentsRenamed" : "attachmentsRenameFailed" : outcome === "resolve" ? "attachmentsDeleted" : "attachmentsDeleteFailed";
> 76 | expect(await screen.findByText(translations.nb[key])).toBeVisible();
| ^
77 | expect(screen.queryByText(translations.en[key])).not.toBeInTheDocument();
78 | expect(write).toHaveBeenCalledWith("/attachments/7", ...(action === "rename" ? [{ fileName: "New name.pdf" }] : []));
79 | });
at waitForWrapper (node_modules/@testing-library/dom/dist/wait-for.js:163:27)
at node_modules/@testing-library/dom/dist/query-helpers.js:86:33
at findByText (src/attachment-action-lifetime.test.tsx:76:23)
● attachment rename delayed reject uses current language
Unable to find an element with the text: Kunne ikke gi nytt navn.. This could be because the text is broken up by multiple elements. In this case, you can provide a function for your text matcher to make your matcher more flexible.
Ignored nodes: comments, script, style
<body
style=""
>
<div>
<div
class="MuiBox-root css-0"
>
<div
class="MuiBox-root css-1owejxv"
>
<div
class="MuiBox-root css-0"
>
<p
class="MuiTypography-root MuiTypography-body1 css-1v8ok63-MuiTypography-root"
>
Vedlegg (1)
</p>
<p
class="MuiTypography-root MuiTypography-body2 css-1qf9eb3-MuiTypography-root"
>
Last opp CV-er, søknadsbrev, porteføljer og støttedokumenter for denne søknaden.
</p>
<div
class="MuiBox-root css-x2j9i8"
>
<div
class="MuiChip-root MuiChip-outlined MuiChip-sizeSmall MuiChip-colorDefault MuiChip-outlinedDefault css-1w2bku1-MuiChip-root"
>
<span
class="MuiChip-label MuiChip-labelSmall css-19m61dl-MuiChip-label"
>
0 bilder
</span>
</div>
<div
class="MuiChip-root MuiChip-outlined MuiChip-sizeSmall MuiChip-colorDefault MuiChip-outlinedDefault css-1w2bku1-MuiChip-root"
>
<span
class="MuiChip-label MuiChip-labelSmall css-19m61dl-MuiChip-label"
>
1 PDF-er
</span>
</div>
<div
class="MuiChip-root MuiChip-outlined MuiChip-sizeSmall MuiChip-colorDefault MuiChip-outlinedDefault css-1w2bku1-MuiChip-root"
>
<span
class="MuiChip-label MuiChip-labelSmall css-19m61dl-MuiChip-label"
>
Maks 10 MB hver
</span>
</div>
</div>
</div>
<button
class="MuiButtonBase-root MuiButton-root MuiButton-outlined MuiButton-outlinedPrimary MuiButton-sizeSmall MuiButton-outlinedSizeSmall MuiButton-colorPrimary MuiButton-root MuiButton-outlined MuiButton-outlinedPrimary MuiButton-sizeSmall MuiButton-outlinedSizeSmall MuiButton-colorPrimary css-74b9is-MuiButtonBase-root-MuiButton-root"
tabindex="0"
type="button"
>
<span
class="MuiButton-icon MuiButton-startIcon MuiButton-iconSizeSmall css-d8i980-MuiButton-startIcon"
>
<svg
aria-hidden="true"
class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium css-1umw9bq-MuiSvgIcon-root"
data-testid="CloudUploadOutlinedIcon"
focusable="false"
viewBox="0 0 24 24"
>
<path
d="M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96M19 18H6c-2.21 0-4-1.79-4-4 0-2.05 1.53-3.76 3.56-3.97l1.07-.11.5-.95C8.08 7.14 9.94 6 12 6c2.62 0 4.88 1.86 5.39 4.43l.3 1.5 1.53.11c1.56.1 2.78 1.41 2.78 2.96 0 1.65-1.35 3-3 3M8 13h2.55v3h2.9v-3H16l-4-4z"
/>
</svg>
</span>
Last opp
</button>
<input
hidden=""
multiple=""
type="file"
/>
</div>
<div
class="MuiBox-root css-497k9w"
>
<p
class="MuiTypography-root MuiTypography-body1 css-1g7ym63-MuiTypography-root"
>
Dra og slipp filer her
</p>
<p
class="MuiTypography-root MuiTypography-body2 css-1moljxt-MuiTypography-root"
>
eller bruk opplastingsknappen for å velge dokumenter fra enheten din.
</p>
</div>
<span
aria-atomic="true"
aria-live="polite"
class="MuiBox-root css-ty8jgw"
role="status"
>
Innhold lastet.
</span>
<div
aria-label="Vedlegg (1)"
class="MuiTableContainer-root css-1sde01b-MuiTableContainer-root"
role="region"
tabindex="0"
>
<table
aria-label="Gjeldende dokumenter"
class="MuiTable-root css-1ii7ygr-MuiTable-root"
>
<thead
class="MuiTableHead-root css-1a7iywq-MuiTableHead-root"
>
<tr
class="MuiTableRow-root MuiTableRow-head css-1xtozoh-MuiTableRow-root"
>
<th
class="MuiTableCell-root MuiTableCell-head MuiTableCell-sizeSmall css-10umtgd-MuiTableCell-root"
scope="col"
>
Navn
</th>
<th
class="MuiTableCell-root MuiTableCell-head MuiTableCell-sizeSmall css-vgdc2f-MuiTableCell-root"
scope="col"
>
Type
</th>
<th
class="MuiTableCell-root MuiTableCell-head MuiTableCell-sizeSmall css-by61h7-MuiTableCell-root"
scope="col"
>
Filtype
</th>
<th
class="MuiTableCell-root MuiTableCell-head MuiTableCell-sizeSmall css-1vxk39h-MuiTableCell-root"
scope="col"
>
...
74 | await act(async () => { if (outcome === "resolve") pending.resolve({ data: {} }); else pending.reject(new Error("synthetic write failure")); });
75 | const key = action === "rename" ? outcome === "resolve" ? "attachmentsRenamed" : "attachmentsRenameFailed" : outcome === "resolve" ? "attachmentsDeleted" : "attachmentsDeleteFailed";
> 76 | expect(await screen.findByText(translations.nb[key])).toBeVisible();
| ^
77 | expect(screen.queryByText(translations.en[key])).not.toBeInTheDocument();
78 | expect(write).toHaveBeenCalledWith("/attachments/7", ...(action === "rename" ? [{ fileName: "New name.pdf" }] : []));
79 | });
at waitForWrapper (node_modules/@testing-library/dom/dist/wait-for.js:163:27)
at node_modules/@testing-library/dom/dist/query-helpers.js:86:33
at findByText (src/attachment-action-lifetime.test.tsx:76:23)
● attachment delete delayed resolve uses current language
Unable to find an element with the text: Vedlegg slettet.. This could be because the text is broken up by multiple elements. In this case, you can provide a function for your text matcher to make your matcher more flexible.
Ignored nodes: comments, script, style
<body
style=""
>
<div>
<div
class="MuiBox-root css-0"
>
<div
class="MuiBox-root css-1owejxv"
>
<div
class="MuiBox-root css-0"
>
<p
class="MuiTypography-root MuiTypography-body1 css-1v8ok63-MuiTypography-root"
>
Vedlegg (1)
</p>
<p
class="MuiTypography-root MuiTypography-body2 css-1qf9eb3-MuiTypography-root"
>
Last opp CV-er, søknadsbrev, porteføljer og støttedokumenter for denne søknaden.
</p>
<div
class="MuiBox-root css-x2j9i8"
>
<div
class="MuiChip-root MuiChip-outlined MuiChip-sizeSmall MuiChip-colorDefault MuiChip-outlinedDefault css-1w2bku1-MuiChip-root"
>
<span
class="MuiChip-label MuiChip-labelSmall css-19m61dl-MuiChip-label"
>
0 bilder
</span>
</div>
<div
class="MuiChip-root MuiChip-outlined MuiChip-sizeSmall MuiChip-colorDefault MuiChip-outlinedDefault css-1w2bku1-MuiChip-root"
>
<span
class="MuiChip-label MuiChip-labelSmall css-19m61dl-MuiChip-label"
>
1 PDF-er
</span>
</div>
<div
class="MuiChip-root MuiChip-outlined MuiChip-sizeSmall MuiChip-colorDefault MuiChip-outlinedDefault css-1w2bku1-MuiChip-root"
>
<span
class="MuiChip-label MuiChip-labelSmall css-19m61dl-MuiChip-label"
>
Maks 10 MB hver
</span>
</div>
</div>
</div>
<button
class="MuiButtonBase-root MuiButton-root MuiButton-outlined MuiButton-outlinedPrimary MuiButton-sizeSmall MuiButton-outlinedSizeSmall MuiButton-colorPrimary MuiButton-root MuiButton-outlined MuiButton-outlinedPrimary MuiButton-sizeSmall MuiButton-outlinedSizeSmall MuiButton-colorPrimary css-74b9is-MuiButtonBase-root-MuiButton-root"
tabindex="0"
type="button"
>
<span
class="MuiButton-icon MuiButton-startIcon MuiButton-iconSizeSmall css-d8i980-MuiButton-startIcon"
>
<svg
aria-hidden="true"
class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium css-1umw9bq-MuiSvgIcon-root"
data-testid="CloudUploadOutlinedIcon"
focusable="false"
viewBox="0 0 24 24"
>
<path
d="M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96M19 18H6c-2.21 0-4-1.79-4-4 0-2.05 1.53-3.76 3.56-3.97l1.07-.11.5-.95C8.08 7.14 9.94 6 12 6c2.62 0 4.88 1.86 5.39 4.43l.3 1.5 1.53.11c1.56.1 2.78 1.41 2.78 2.96 0 1.65-1.35 3-3 3M8 13h2.55v3h2.9v-3H16l-4-4z"
/>
</svg>
</span>
Last opp
</button>
<input
hidden=""
multiple=""
type="file"
/>
</div>
<div
class="MuiBox-root css-497k9w"
>
<p
class="MuiTypography-root MuiTypography-body1 css-1g7ym63-MuiTypography-root"
>
Dra og slipp filer her
</p>
<p
class="MuiTypography-root MuiTypography-body2 css-1moljxt-MuiTypography-root"
>
eller bruk opplastingsknappen for å velge dokumenter fra enheten din.
</p>
</div>
<span
aria-atomic="true"
aria-live="polite"
class="MuiBox-root css-ty8jgw"
role="status"
>
Innhold lastet.
</span>
<div
aria-label="Vedlegg (1)"
class="MuiTableContainer-root css-1sde01b-MuiTableContainer-root"
role="region"
tabindex="0"
>
<table
aria-label="Gjeldende dokumenter"
class="MuiTable-root css-1ii7ygr-MuiTable-root"
>
<thead
class="MuiTableHead-root css-1a7iywq-MuiTableHead-root"
>
<tr
class="MuiTableRow-root MuiTableRow-head css-1xtozoh-MuiTableRow-root"
>
<th
class="MuiTableCell-root MuiTableCell-head MuiTableCell-sizeSmall css-10umtgd-MuiTableCell-root"
scope="col"
>
Navn
</th>
<th
class="MuiTableCell-root MuiTableCell-head MuiTableCell-sizeSmall css-vgdc2f-MuiTableCell-root"
scope="col"
>
Type
</th>
<th
class="MuiTableCell-root MuiTableCell-head MuiTableCell-sizeSmall css-by61h7-MuiTableCell-root"
scope="col"
>
Filtype
</th>
<th
class="MuiTableCell-root MuiTableCell-head MuiTableCell-sizeSmall css-1vxk39h-MuiTableCell-root"
scope="col"
>
...
74 | await act(async () => { if (outcome === "resolve") pending.resolve({ data: {} }); else pending.reject(new Error("synthetic write failure")); });
75 | const key = action === "rename" ? outcome === "resolve" ? "attachmentsRenamed" : "attachmentsRenameFailed" : outcome === "resolve" ? "attachmentsDeleted" : "attachmentsDeleteFailed";
> 76 | expect(await screen.findByText(translations.nb[key])).toBeVisible();
| ^
77 | expect(screen.queryByText(translations.en[key])).not.toBeInTheDocument();
78 | expect(write).toHaveBeenCalledWith("/attachments/7", ...(action === "rename" ? [{ fileName: "New name.pdf" }] : []));
79 | });
at waitForWrapper (node_modules/@testing-library/dom/dist/wait-for.js:163:27)
at node_modules/@testing-library/dom/dist/query-helpers.js:86:33
at findByText (src/attachment-action-lifetime.test.tsx:76:23)
● attachment delete delayed reject uses current language
Unable to find an element with the text: Sletting mislyktes.. This could be because the text is broken up by multiple elements. In this case, you can provide a function for your text matcher to make your matcher more flexible.
Ignored nodes: comments, script, style
<body
style=""
>
<div>
<div
class="MuiBox-root css-0"
>
<div
class="MuiBox-root css-1owejxv"
>
<div
class="MuiBox-root css-0"
>
<p
class="MuiTypography-root MuiTypography-body1 css-1v8ok63-MuiTypography-root"
>
Vedlegg (1)
</p>
<p
class="MuiTypography-root MuiTypography-body2 css-1qf9eb3-MuiTypography-root"
>
Last opp CV-er, søknadsbrev, porteføljer og støttedokumenter for denne søknaden.
</p>
<div
class="MuiBox-root css-x2j9i8"
>
<div
class="MuiChip-root MuiChip-outlined MuiChip-sizeSmall MuiChip-colorDefault MuiChip-outlinedDefault css-1w2bku1-MuiChip-root"
>
<span
class="MuiChip-label MuiChip-labelSmall css-19m61dl-MuiChip-label"
>
0 bilder
</span>
</div>
<div
class="MuiChip-root MuiChip-outlined MuiChip-sizeSmall MuiChip-colorDefault MuiChip-outlinedDefault css-1w2bku1-MuiChip-root"
>
<span
class="MuiChip-label MuiChip-labelSmall css-19m61dl-MuiChip-label"
>
1 PDF-er
</span>
</div>
<div
class="MuiChip-root MuiChip-outlined MuiChip-sizeSmall MuiChip-colorDefault MuiChip-outlinedDefault css-1w2bku1-MuiChip-root"
>
<span
class="MuiChip-label MuiChip-labelSmall css-19m61dl-MuiChip-label"
>
Maks 10 MB hver
</span>
</div>
</div>
</div>
<button
class="MuiButtonBase-root MuiButton-root MuiButton-outlined MuiButton-outlinedPrimary MuiButton-sizeSmall MuiButton-outlinedSizeSmall MuiButton-colorPrimary MuiButton-root MuiButton-outlined MuiButton-outlinedPrimary MuiButton-sizeSmall MuiButton-outlinedSizeSmall MuiButton-colorPrimary css-74b9is-MuiButtonBase-root-MuiButton-root"
tabindex="0"
type="button"
>
<span
class="MuiButton-icon MuiButton-startIcon MuiButton-iconSizeSmall css-d8i980-MuiButton-startIcon"
>
<svg
aria-hidden="true"
class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium css-1umw9bq-MuiSvgIcon-root"
data-testid="CloudUploadOutlinedIcon"
focusable="false"
viewBox="0 0 24 24"
>
<path
d="M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96M19 18H6c-2.21 0-4-1.79-4-4 0-2.05 1.53-3.76 3.56-3.97l1.07-.11.5-.95C8.08 7.14 9.94 6 12 6c2.62 0 4.88 1.86 5.39 4.43l.3 1.5 1.53.11c1.56.1 2.78 1.41 2.78 2.96 0 1.65-1.35 3-3 3M8 13h2.55v3h2.9v-3H16l-4-4z"
/>
</svg>
</span>
Last opp
</button>
<input
hidden=""
multiple=""
type="file"
/>
</div>
<div
class="MuiBox-root css-497k9w"
>
<p
class="MuiTypography-root MuiTypography-body1 css-1g7ym63-MuiTypography-root"
>
Dra og slipp filer her
</p>
<p
class="MuiTypography-root MuiTypography-body2 css-1moljxt-MuiTypography-root"
>
eller bruk opplastingsknappen for å velge dokumenter fra enheten din.
</p>
</div>
<span
aria-atomic="true"
aria-live="polite"
class="MuiBox-root css-ty8jgw"
role="status"
>
Innhold lastet.
</span>
<div
aria-label="Vedlegg (1)"
class="MuiTableContainer-root css-1sde01b-MuiTableContainer-root"
role="region"
tabindex="0"
>
<table
aria-label="Gjeldende dokumenter"
class="MuiTable-root css-1ii7ygr-MuiTable-root"
>
<thead
class="MuiTableHead-root css-1a7iywq-MuiTableHead-root"
>
<tr
class="MuiTableRow-root MuiTableRow-head css-1xtozoh-MuiTableRow-root"
>
<th
class="MuiTableCell-root MuiTableCell-head MuiTableCell-sizeSmall css-10umtgd-MuiTableCell-root"
scope="col"
>
Navn
</th>
<th
class="MuiTableCell-root MuiTableCell-head MuiTableCell-sizeSmall css-vgdc2f-MuiTableCell-root"
scope="col"
>
Type
</th>
<th
class="MuiTableCell-root MuiTableCell-head MuiTableCell-sizeSmall css-by61h7-MuiTableCell-root"
scope="col"
>
Filtype
</th>
<th
class="MuiTableCell-root MuiTableCell-head MuiTableCell-sizeSmall css-1vxk39h-MuiTableCell-root"
scope="col"
>
...
74 | await act(async () => { if (outcome === "resolve") pending.resolve({ data: {} }); else pending.reject(new Error("synthetic write failure")); });
75 | const key = action === "rename" ? outcome === "resolve" ? "attachmentsRenamed" : "attachmentsRenameFailed" : outcome === "resolve" ? "attachmentsDeleted" : "attachmentsDeleteFailed";
> 76 | expect(await screen.findByText(translations.nb[key])).toBeVisible();
| ^
77 | expect(screen.queryByText(translations.en[key])).not.toBeInTheDocument();
78 | expect(write).toHaveBeenCalledWith("/attachments/7", ...(action === "rename" ? [{ fileName: "New name.pdf" }] : []));
79 | });
at waitForWrapper (node_modules/@testing-library/dom/dist/wait-for.js:163:27)
at node_modules/@testing-library/dom/dist/query-helpers.js:86:33
at findByText (src/attachment-action-lifetime.test.tsx:76:23)
Test Suites: 1 failed, 1 total
Tests: 10 failed, 10 total
Snapshots: 0 total
Time: 22.037 s
Ran all test suites matching src/attachment-action-lifetime.test.tsx.
Test results written to: E:\Storage\Projects\Active\temp docs\jobjakt-local-build\attachment-action-red.json