Skip to content

Commit 33c7ea5

Browse files
committed
test(server): simplify untracked status scenarios
1 parent 24b84d3 commit 33c7ea5

1 file changed

Lines changed: 14 additions & 20 deletions

File tree

‎apps/server/src/vcs/GitVcsDriverCore.test.ts‎

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3176,39 +3176,33 @@ it.layer(layerTest)("GitVcsDriver core integration", (it) => {
31763176
{ concurrency: 32, discard: true },
31773177
);
31783178

3179-
for (const mode of ["normal", "all", "no"]) {
3179+
for (const scenario of ["normal", "all", "no", "long names"]) {
3180+
if (scenario === "long names") {
3181+
yield* Effect.forEach(
3182+
Array.from({ length: 50 }, (_, index) => `${"a".repeat(180)}-${index}.txt`),
3183+
(file) => writeTextFile(cwd, file, "long name\n"),
3184+
{ concurrency: 32, discard: true },
3185+
);
3186+
}
3187+
const mode = scenario === "long names" ? "normal" : scenario;
31803188
yield* git(cwd, ["config", "status.showUntrackedFiles", mode]);
31813189
untrackedScanRoots.length = 0;
31823190
const status = yield* driver.statusDetailsLocal(cwd, { includeBranchChanges: true });
31833191
assert.deepStrictEqual(status.branchChanges, {
31843192
baseRef: "main",
3185-
insertions: 2_002,
3193+
insertions: scenario === "long names" ? 2_052 : 2_002,
31863194
deletions: 0,
31873195
});
3188-
assert.lengthOf(untrackedScanRoots, 1);
3189-
assert.equal(untrackedScanRoots[0]!.length === 0, mode !== "normal");
3190-
if (mode === "normal") {
3196+
assert.deepStrictEqual(untrackedScanRoots, [
3197+
scenario === "normal" ? [":(top,literal)bulk[1]/"] : [],
3198+
]);
3199+
if (scenario === "normal") {
31913200
assert.deepStrictEqual(
31923201
status.workingTree.files.map((file) => file.path),
31933202
["bulk[1]/"],
31943203
);
31953204
}
31963205
}
3197-
3198-
yield* git(cwd, ["config", "status.showUntrackedFiles", "normal"]);
3199-
yield* Effect.forEach(
3200-
Array.from({ length: 50 }, (_, index) => `${"a".repeat(180)}-${index}.txt`),
3201-
(file) => writeTextFile(cwd, file, "long name\n"),
3202-
{ concurrency: 32, discard: true },
3203-
);
3204-
untrackedScanRoots.length = 0;
3205-
const longNames = yield* driver.statusDetailsLocal(cwd, { includeBranchChanges: true });
3206-
assert.deepStrictEqual(longNames.branchChanges, {
3207-
baseRef: "main",
3208-
insertions: 2_052,
3209-
deletions: 0,
3210-
});
3211-
assert.deepStrictEqual(untrackedScanRoots, [[]]);
32123206
}),
32133207
);
32143208

0 commit comments

Comments
 (0)