@exagone313/dsh-podman 1.0.3 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. package/dist/generated/version.d.ts +2 -2
  2. package/dist/generated/version.js +2 -2
  3. package/docs/development.md +8 -4
  4. package/docs/development.zh.md +7 -4
  5. package/package.json +3 -1
  6. package/dist/approval-reasons.test.d.ts +0 -1
  7. package/dist/approval-reasons.test.js +0 -143
  8. package/dist/approval.test.d.ts +0 -1
  9. package/dist/approval.test.js +0 -593
  10. package/dist/card-route.test.d.ts +0 -1
  11. package/dist/card-route.test.js +0 -223
  12. package/dist/card-test-support.d.ts +0 -15
  13. package/dist/card-test-support.js +0 -133
  14. package/dist/container-env.test.d.ts +0 -1
  15. package/dist/container-env.test.js +0 -93
  16. package/dist/containers.test.d.ts +0 -1
  17. package/dist/containers.test.js +0 -621
  18. package/dist/daemons.test.d.ts +0 -1
  19. package/dist/daemons.test.js +0 -167
  20. package/dist/dsh-version.test.d.ts +0 -1
  21. package/dist/dsh-version.test.js +0 -25
  22. package/dist/env-rows.test.d.ts +0 -1
  23. package/dist/env-rows.test.js +0 -43
  24. package/dist/fs-provider.test.d.ts +0 -1
  25. package/dist/fs-provider.test.js +0 -301
  26. package/dist/guest-rpc.test.d.ts +0 -1
  27. package/dist/guest-rpc.test.js +0 -241
  28. package/dist/images.test.d.ts +0 -1
  29. package/dist/images.test.js +0 -86
  30. package/dist/locales.test.d.ts +0 -1
  31. package/dist/locales.test.js +0 -34
  32. package/dist/misc.test.d.ts +0 -1
  33. package/dist/misc.test.js +0 -169
  34. package/dist/mounts.test.d.ts +0 -1
  35. package/dist/mounts.test.js +0 -478
  36. package/dist/naming.test.d.ts +0 -1
  37. package/dist/naming.test.js +0 -28
  38. package/dist/package-deps.test.d.ts +0 -1
  39. package/dist/package-deps.test.js +0 -49
  40. package/dist/paths.test.d.ts +0 -1
  41. package/dist/paths.test.js +0 -76
  42. package/dist/plugin-meta.test.d.ts +0 -1
  43. package/dist/plugin-meta.test.js +0 -29
  44. package/dist/project-path.test.d.ts +0 -1
  45. package/dist/project-path.test.js +0 -66
  46. package/dist/read-only-shell.test.d.ts +0 -1
  47. package/dist/read-only-shell.test.js +0 -182
  48. package/dist/runtime-client.test.d.ts +0 -1
  49. package/dist/runtime-client.test.js +0 -53
  50. package/dist/secrets.test.d.ts +0 -1
  51. package/dist/secrets.test.js +0 -196
  52. package/dist/settings-commands.test.d.ts +0 -1
  53. package/dist/settings-commands.test.js +0 -596
  54. package/dist/settings-create.test.d.ts +0 -1
  55. package/dist/settings-create.test.js +0 -416
  56. package/dist/settings-default-env.test.d.ts +0 -1
  57. package/dist/settings-default-env.test.js +0 -175
  58. package/dist/settings-mounts.test.d.ts +0 -1
  59. package/dist/settings-mounts.test.js +0 -506
  60. package/dist/settings-paths.test.d.ts +0 -1
  61. package/dist/settings-paths.test.js +0 -65
  62. package/dist/settings-schema.test.d.ts +0 -1
  63. package/dist/settings-schema.test.js +0 -35
  64. package/dist/settings-workspaces.test.d.ts +0 -1
  65. package/dist/settings-workspaces.test.js +0 -240
  66. package/dist/spill-store.test.d.ts +0 -1
  67. package/dist/spill-store.test.js +0 -82
  68. package/dist/subprocess.test.d.ts +0 -1
  69. package/dist/subprocess.test.js +0 -344
  70. package/dist/terminal-preference.test.d.ts +0 -1
  71. package/dist/terminal-preference.test.js +0 -62
  72. package/dist/terminal-route.test.d.ts +0 -1
  73. package/dist/terminal-route.test.js +0 -265
  74. package/dist/terminal-tab.test.d.ts +0 -1
  75. package/dist/terminal-tab.test.js +0 -58
  76. package/dist/terminal-targets.test.d.ts +0 -1
  77. package/dist/terminal-targets.test.js +0 -43
  78. package/dist/terminal-titles.test.d.ts +0 -1
  79. package/dist/terminal-titles.test.js +0 -36
  80. package/dist/test-support.d.ts +0 -358
  81. package/dist/test-support.js +0 -499
  82. package/dist/version-compat.test.d.ts +0 -1
  83. package/dist/version-compat.test.js +0 -27
  84. package/dist/views.test.d.ts +0 -1
  85. package/dist/views.test.js +0 -23
  86. package/dist/volumes.test.d.ts +0 -1
  87. package/dist/volumes.test.js +0 -40
  88. package/dist/workspace-binding.test.d.ts +0 -1
  89. package/dist/workspace-binding.test.js +0 -523
@@ -1,223 +0,0 @@
1
- // SPDX-FileCopyrightText: 2026 Elouan Martinet <exa@elou.world>
2
- //
3
- // SPDX-License-Identifier: MIT
4
- import { test } from "node:test";
5
- import { strict as assert } from "node:assert";
6
- import { CARD_PATH } from "./client/card-protocol.js";
7
- import { registerCardRoute } from "./card-route.js";
8
- function fakeResolver() {
9
- const calls = [];
10
- const resolver = {
11
- getConfig: () => ({
12
- defaultImage: "archlinux",
13
- socketsRoot: "/run/dsh-podman",
14
- projectsRoot: "/projects",
15
- }),
16
- setConfig: () => { },
17
- async control(method, request) {
18
- calls.push([method, request]);
19
- if (method === "getVersion")
20
- return { version: "9.9.9", commit: "abc" };
21
- if (method === "listContainers") {
22
- return { containers: [{ containerName: "c1" }] };
23
- }
24
- if (method === "listImages")
25
- return { images: [{ imageId: "img1" }] };
26
- if (method === "listWorkspaces")
27
- return { workspaces: [] };
28
- if (method === "listVolumes")
29
- return { volumes: [{ name: "data" }] };
30
- if (method === "listSecrets")
31
- return { secrets: [{ name: "s1" }] };
32
- if (method === "listCaches") {
33
- return { caches: [{ manager: "pacman", files: 1, bytes: "1024" }] };
34
- }
35
- if (method === "cleanCaches")
36
- return { removedFiles: 2 };
37
- if (method === "removeContainer")
38
- return {};
39
- return {};
40
- },
41
- };
42
- return { resolver, calls };
43
- }
44
- function fakeRouteContext() {
45
- const routes = [];
46
- const ctx = {
47
- inject(deps, callback) {
48
- assert.deepEqual(deps, ["connection"]);
49
- callback({
50
- connection: {
51
- fetch: {
52
- register(route) {
53
- // Mirror the harness's assertFetchRoute: the route must live
54
- // under the API channel, or the registration is refused.
55
- if (!route.path.startsWith("/api/")) {
56
- throw new Error(`connection: invalid exact Fetch route ${JSON.stringify(route.path)}`);
57
- }
58
- routes.push(route);
59
- return async () => { };
60
- },
61
- },
62
- },
63
- });
64
- },
65
- };
66
- return { ctx, routes };
67
- }
68
- function cardRequest(init) {
69
- return new Request(`http://dsh.test${CARD_PATH}`, init);
70
- }
71
- test("registerCardRoute registers the card's exact fetch route", () => {
72
- assert.ok(CARD_PATH.startsWith("/api/"), "the route must live under the API channel");
73
- const { resolver } = fakeResolver();
74
- const { ctx, routes } = fakeRouteContext();
75
- registerCardRoute(ctx, resolver);
76
- assert.equal(routes.length, 1);
77
- assert.equal(routes[0].path, CARD_PATH);
78
- assert.deepEqual(routes[0].methods, ["GET", "POST"]);
79
- assert.equal(routes[0].requestBody, "buffered");
80
- });
81
- test("the card route serves the live snapshot on GET", async () => {
82
- const { resolver, calls } = fakeResolver();
83
- const { ctx, routes } = fakeRouteContext();
84
- registerCardRoute(ctx, resolver);
85
- const response = await routes[0].fetch(cardRequest());
86
- assert.equal(response.status, 200);
87
- const snapshot = (await response.json());
88
- assert.equal(snapshot.projectsRoot, "/projects");
89
- assert.equal(snapshot.containers.length, 1);
90
- assert.equal(snapshot.images.length, 1);
91
- assert.deepEqual(snapshot.volumes, [{ name: "data" }]);
92
- assert.deepEqual(snapshot.secrets, [{ name: "s1" }]);
93
- assert.equal(snapshot.caches[0].bytes, 1024);
94
- assert.deepEqual(calls.map(([method]) => method), [
95
- "getVersion",
96
- "listContainers",
97
- "listImages",
98
- "listWorkspaces",
99
- "listVolumes",
100
- "listSecrets",
101
- "listCaches",
102
- ]);
103
- assert.equal(typeof snapshot.dshVersion, "string");
104
- assert.equal(snapshot.orchestratorVersion, "9.9.9");
105
- assert.equal(snapshot.versionState, "major-mismatch", "a differing major is surfaced on the card");
106
- });
107
- test("a refused control call reports the version mismatch instead of an empty snapshot", async () => {
108
- const { resolver } = fakeResolver();
109
- const refusal = new Error("plugin is incompatible");
110
- refusal.code = "FailedPrecondition";
111
- resolver.control = async (method) => {
112
- if (method === "getVersion")
113
- return { version: "9.9.9", commit: "abc" };
114
- throw refusal;
115
- };
116
- const { ctx, routes } = fakeRouteContext();
117
- registerCardRoute(ctx, resolver);
118
- const response = await routes[0].fetch(cardRequest());
119
- assert.equal(response.status, 200);
120
- const snapshot = (await response.json());
121
- assert.equal(typeof snapshot.dshVersion, "string");
122
- assert.equal(snapshot.orchestratorVersion, "9.9.9");
123
- assert.equal(snapshot.versionState, "major-mismatch");
124
- assert.deepEqual(snapshot.containers, []);
125
- assert.deepEqual(snapshot.workspaces, []);
126
- });
127
- test("the card route runs one command per POST and returns its notice", async () => {
128
- const { resolver, calls } = fakeResolver();
129
- const { ctx, routes } = fakeRouteContext();
130
- registerCardRoute(ctx, resolver);
131
- const remove = await routes[0].fetch(cardRequest({
132
- method: "POST",
133
- body: JSON.stringify({ command: { op: "remove", workspace: "w1" } }),
134
- }));
135
- assert.equal(remove.status, 200);
136
- assert.deepEqual(await remove.json(), {});
137
- // A command that names no container keeps the orchestrator's default; one that
138
- // names a container must reach it, or a row's Remove would hit another one.
139
- const removeNamed = await routes[0].fetch(cardRequest({
140
- method: "POST",
141
- body: JSON.stringify({
142
- command: { op: "remove", workspace: "w1", container: "foo" },
143
- }),
144
- }));
145
- assert.equal(removeNamed.status, 200);
146
- const removeCalls = calls.filter(([method]) => method === "removeContainer");
147
- assert.deepEqual(removeCalls[0]?.[1], { workspaceSlug: "w1" });
148
- assert.deepEqual(removeCalls[1]?.[1], {
149
- workspaceSlug: "w1",
150
- container: "foo",
151
- });
152
- const recreate = await routes[0].fetch(cardRequest({
153
- method: "POST",
154
- body: JSON.stringify({
155
- command: {
156
- op: "recreate",
157
- workspace: "w1",
158
- container: "foo",
159
- image: "img1",
160
- },
161
- }),
162
- }));
163
- assert.equal(recreate.status, 200);
164
- assert.deepEqual(calls.find(([method]) => method === "recreateContainer")?.[1], {
165
- workspaceSlug: "w1",
166
- container: "foo",
167
- imageId: "img1",
168
- });
169
- const detach = await routes[0].fetch(cardRequest({
170
- method: "POST",
171
- body: JSON.stringify({
172
- command: {
173
- op: "container_secret_remove",
174
- workspace: "w1",
175
- container: "foo",
176
- secretEnvName: "TOKEN",
177
- },
178
- }),
179
- }));
180
- assert.equal(detach.status, 200);
181
- assert.deepEqual(calls.find(([method]) => method === "removeContainerSecret")?.[1], { workspaceSlug: "w1", container: "foo", env: "TOKEN" });
182
- const clean = await routes[0].fetch(cardRequest({
183
- method: "POST",
184
- body: JSON.stringify({ command: { op: "cache_clean", cacheMode: "all" } }),
185
- }));
186
- assert.equal(clean.status, 200);
187
- assert.deepEqual(await clean.json(), { notice: "removed 2 cached files" });
188
- });
189
- test("the card route rejects a missing or unknown command", async () => {
190
- const { resolver } = fakeResolver();
191
- const { ctx, routes } = fakeRouteContext();
192
- registerCardRoute(ctx, resolver);
193
- const missing = await routes[0].fetch(cardRequest({ method: "POST", body: "{}" }));
194
- assert.equal(missing.status, 400);
195
- const unknown = await routes[0].fetch(cardRequest({
196
- method: "POST",
197
- body: JSON.stringify({ command: { op: "nope" } }),
198
- }));
199
- assert.equal(unknown.status, 400);
200
- const malformed = await routes[0].fetch(cardRequest({ method: "POST", body: "not json" }));
201
- assert.equal(malformed.status, 400);
202
- const wrongMethod = await routes[0].fetch(cardRequest({ method: "DELETE" }));
203
- assert.equal(wrongMethod.status, 405);
204
- });
205
- test("the card route reports a failed command as an error", async () => {
206
- const resolver = {
207
- getConfig: () => ({ projectsRoot: "/projects" }),
208
- setConfig: () => { },
209
- async control() {
210
- throw new Error("control plane unavailable");
211
- },
212
- };
213
- const { ctx, routes } = fakeRouteContext();
214
- registerCardRoute(ctx, resolver);
215
- const response = await routes[0].fetch(cardRequest({
216
- method: "POST",
217
- body: JSON.stringify({ command: { op: "remove", workspace: "w1" } }),
218
- }));
219
- assert.equal(response.status, 500);
220
- assert.deepEqual(await response.json(), {
221
- error: "control plane unavailable",
222
- });
223
- });
@@ -1,15 +0,0 @@
1
- export interface FakeScope {
2
- value: Record<string, unknown>;
3
- listeners: Array<(next: any, prev: any) => void>;
4
- update: (patch: object) => Promise<void>;
5
- watch: (callback: (next: any, prev: any) => void | Promise<void>) => () => void;
6
- }
7
- export declare function fakeScope(initial: Record<string, unknown>): FakeScope;
8
- export declare function fakeContext(scope: FakeScope): any;
9
- export declare function baseValue(): Record<string, unknown>;
10
- export declare function installCardCommandDriver(ctx: any, resolver: any, registry?: any): Promise<void>;
11
- export declare function installedMountScope(): Promise<{
12
- scope: FakeScope;
13
- calls: Array<[string, unknown]>;
14
- }>;
15
- export declare function mountCommand(op: string, mount: Record<string, string>): Record<string, unknown>;
@@ -1,133 +0,0 @@
1
- // SPDX-FileCopyrightText: 2026 Elouan Martinet <exa@elou.world>
2
- //
3
- // SPDX-License-Identifier: MIT
4
- // Test doubles for the settings card. `installCardCommandDriver` stands in for
5
- // the browser transport: it hands each committed command to the real
6
- // `runCommand` and folds the real `cardSnapshot` back into the fake scope, so
7
- // the command tests stay focused on the command-to-control mapping. The HTTP
8
- // layer itself is covered by card-route.test.ts.
9
- import { cardSnapshot, runCommand } from "./card-route.js";
10
- export function fakeScope(initial) {
11
- const scope = {
12
- value: { ...initial },
13
- listeners: [],
14
- async update(patch) {
15
- const prev = scope.value;
16
- scope.value = { ...scope.value, ...patch };
17
- for (const listener of [...scope.listeners]) {
18
- await listener(scope.value, prev);
19
- }
20
- },
21
- watch(callback) {
22
- scope.listeners.push(callback);
23
- return () => {
24
- scope.listeners = scope.listeners.filter((listener) => listener !== callback);
25
- };
26
- },
27
- };
28
- return scope;
29
- }
30
- export function fakeContext(scope) {
31
- // The host half no longer registers a settings namespace: the card's
32
- // preferences are volatile plugin-config fields, so the fake document is
33
- // handed to the driver directly.
34
- return { fakeScope: scope };
35
- }
36
- export function baseValue() {
37
- return {
38
- defaultImage: "archlinux",
39
- uiLocale: "",
40
- notice: "",
41
- command: null,
42
- workspaces: [],
43
- containers: [],
44
- images: [],
45
- volumes: [],
46
- secrets: [],
47
- caches: [],
48
- };
49
- }
50
- // installCardCommandDriver wires a fake settings document to the real command
51
- // runner and snapshot builder, standing in for the browser transport: it
52
- // mirrors what the card does per request — run the command, then refresh the
53
- // live snapshot and record the notice.
54
- export function installCardCommandDriver(ctx, resolver, registry) {
55
- const scope = ctx.fakeScope;
56
- const refresh = async (notice = "") => {
57
- let view = {};
58
- try {
59
- const snapshot = await cardSnapshot(resolver, registry);
60
- view = {
61
- workspaces: snapshot.workspaces,
62
- containers: snapshot.containers,
63
- images: snapshot.images,
64
- volumes: snapshot.volumes,
65
- secrets: snapshot.secrets,
66
- caches: snapshot.caches,
67
- };
68
- }
69
- catch {
70
- // Command tests do not always stub every list call.
71
- }
72
- await scope.update({ ...view, notice });
73
- };
74
- scope.watch((next) => {
75
- const command = next.command;
76
- if (command === null || command === undefined)
77
- return;
78
- void (async () => {
79
- // Clear the command before running it, so the refresh below cannot
80
- // re-deliver it.
81
- await scope.update({ command: null });
82
- let notice = "";
83
- try {
84
- notice = await runCommand(ctx, resolver, registry, command);
85
- }
86
- catch (error) {
87
- notice = error instanceof Error ? error.message : String(error);
88
- }
89
- await refresh(notice);
90
- })();
91
- });
92
- return refresh();
93
- }
94
- export async function installedMountScope() {
95
- const scope = fakeScope(baseValue());
96
- const calls = [];
97
- const resolver = {
98
- getConfig: () => ({}),
99
- setConfig: () => { },
100
- async control(method, request) {
101
- calls.push([method, request]);
102
- if (method === "listContainers")
103
- return { containers: [] };
104
- if (method === "listImages")
105
- return { images: [] };
106
- if (method === "listWorkspaces")
107
- return { workspaces: [] };
108
- return {};
109
- },
110
- };
111
- await installCardCommandDriver(fakeContext(scope), resolver);
112
- await scope.update({}); // settle the queued async refresh
113
- await new Promise((resolve) => setImmediate(resolve));
114
- calls.length = 0;
115
- return { scope, calls };
116
- }
117
- export function mountCommand(op, mount) {
118
- return {
119
- op,
120
- workspace: "w1",
121
- container: "web",
122
- image: "",
123
- mount: {
124
- kind: "",
125
- project: "",
126
- destination: "",
127
- mode: "",
128
- volume: "",
129
- secret: "",
130
- ...mount,
131
- },
132
- };
133
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,93 +0,0 @@
1
- // SPDX-FileCopyrightText: 2026 Elouan Martinet <exa@elou.world>
2
- //
3
- // SPDX-License-Identifier: MIT
4
- import test from "node:test";
5
- import assert from "node:assert/strict";
6
- import { commitIdentityAction, GIT_IDENTITY_KEYS, gitIdentityEnv, gitOnlyDrift, mergeDefaultEnv, missingDefaultEnv, readGitIdentity, setGitIdentity, } from "./container-env.js";
7
- test("mergeDefaultEnv seeds defaults under the container's own env", () => {
8
- assert.deepEqual(mergeDefaultEnv({ A: "1", B: "2" }, { B: "own", C: "3" }), {
9
- A: "1",
10
- B: "own",
11
- C: "3",
12
- });
13
- assert.deepEqual(mergeDefaultEnv(undefined, { A: "1" }), { A: "1" });
14
- assert.deepEqual(mergeDefaultEnv({ A: "1" }, undefined), { A: "1" });
15
- });
16
- test("mergeDefaultEnv drops empty and reserved defaults", () => {
17
- assert.deepEqual(mergeDefaultEnv({ "": "x", DSH_PODMAN_GUEST_TOKEN: "x", KEEP: "1" }, {}), { KEEP: "1" });
18
- // An explicit value in the reserved namespace is the caller's own doing and
19
- // is left to the orchestrator's validation.
20
- assert.deepEqual(mergeDefaultEnv({}, { DSH_PODMAN_GUEST_TOKEN: "x" }), {
21
- DSH_PODMAN_GUEST_TOKEN: "x",
22
- });
23
- });
24
- test("missingDefaultEnv reports only the absent keys", () => {
25
- assert.deepEqual(missingDefaultEnv({ A: "1", B: "2" }, { B: "own" }), {
26
- A: "1",
27
- });
28
- assert.deepEqual(missingDefaultEnv({ A: "1" }, { A: "own" }), {});
29
- assert.deepEqual(missingDefaultEnv(undefined, {}), {});
30
- });
31
- test("git identity fills the author and committer pairs", () => {
32
- assert.deepEqual(gitIdentityEnv("John Doe", "john.doe@git.example"), {
33
- GIT_AUTHOR_NAME: "John Doe",
34
- GIT_AUTHOR_EMAIL: "john.doe@git.example",
35
- GIT_COMMITTER_NAME: "John Doe",
36
- GIT_COMMITTER_EMAIL: "john.doe@git.example",
37
- });
38
- assert.deepEqual(readGitIdentity(gitIdentityEnv("John Doe", "john.doe@git.example")), {
39
- name: "John Doe",
40
- email: "john.doe@git.example",
41
- });
42
- assert.deepEqual(readGitIdentity(undefined), { name: "", email: "" });
43
- });
44
- test("setGitIdentity adds, replaces and clears the four keys", () => {
45
- const base = { KEEP: "1", GIT_AUTHOR_NAME: "old" };
46
- const set = setGitIdentity(base, "new", "new@example.com");
47
- assert.deepEqual(set, {
48
- KEEP: "1",
49
- ...gitIdentityEnv("new", "new@example.com"),
50
- });
51
- for (const key of GIT_IDENTITY_KEYS)
52
- assert.ok(key in set);
53
- // An empty field clears the whole identity, leaving other defaults alone.
54
- assert.deepEqual(setGitIdentity(set, "", "new@example.com"), { KEEP: "1" });
55
- assert.deepEqual(setGitIdentity(set, "new", ""), { KEEP: "1" });
56
- // The input map is not mutated.
57
- assert.deepEqual(base, { KEEP: "1", GIT_AUTHOR_NAME: "old" });
58
- });
59
- test("gitOnlyDrift tells an identity-only change apart from other edits", () => {
60
- const identity = gitIdentityEnv("John Doe", "john.doe@git.example");
61
- // No drift at all qualifies (there is nothing else to lose by committing).
62
- assert.equal(gitOnlyDrift(identity, identity), true);
63
- // Changing or removing the identity alone is git-only.
64
- assert.equal(gitOnlyDrift(identity, setGitIdentity(identity, "New", "new@example.com")), true);
65
- assert.equal(gitOnlyDrift(identity, setGitIdentity(identity, "", "")), true);
66
- // Any other default drift means the Save button must stay in charge.
67
- assert.equal(gitOnlyDrift(identity, { ...identity, KEEP: "1" }), false);
68
- assert.equal(gitOnlyDrift({ KEEP: "1" }, { KEEP: "2" }), false);
69
- // Removing a non-identity key, or an identity key drifting in the server map
70
- // while another edit exists, both count as a real diff.
71
- assert.equal(gitOnlyDrift({ KEEP: "1", ...identity }, identity), false);
72
- });
73
- test("commitIdentityAction applies the popup result without losing edits", () => {
74
- const saved = gitIdentityEnv("John Doe", "john.doe@git.example");
75
- const changed = setGitIdentity(saved, "New", "new@example.com");
76
- // The popup restores the saved identity while the draft still holds the
77
- // changed one: the pending identity edit is discarded, not kept (regression:
78
- // the old code returned early and left the changed identity in the draft).
79
- assert.equal(commitIdentityAction(saved, changed, saved), "discard");
80
- // No drift at all and an unchanged popup is a no-op discard too.
81
- assert.equal(commitIdentityAction(saved, saved, saved), "discard");
82
- // An identity-only change commits straight: nothing else can be lost.
83
- assert.equal(commitIdentityAction(saved, changed, changed), "save");
84
- assert.equal(commitIdentityAction(saved, saved, changed), "save");
85
- // Clearing the identity alone is also git-only.
86
- assert.equal(commitIdentityAction(saved, changed, {}), "save");
87
- // Another pending default keeps the result in the draft, whatever the popup
88
- // does to the identity: change, restore, or clear.
89
- const withKeep = { ...saved, KEEP: "1" };
90
- assert.equal(commitIdentityAction(saved, withKeep, { ...withKeep, ...changed }), "draft");
91
- assert.equal(commitIdentityAction(saved, withKeep, withKeep), "draft");
92
- assert.equal(commitIdentityAction(saved, withKeep, { KEEP: "1" }), "draft");
93
- });
@@ -1 +0,0 @@
1
- export {};