mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-12 07:20:45 +00:00
test(exec): stabilize Windows PATH prepend assertion
This commit is contained in:
@@ -533,7 +533,17 @@ describe("exec PATH handling", () => {
|
||||
|
||||
const text = readNormalizedTextContent(result.content);
|
||||
const entries = text.split(path.delimiter);
|
||||
expect(entries.slice(0, prepend.length)).toEqual(prepend);
|
||||
expect(entries).toContain(basePath);
|
||||
const prependIndexes = prepend.map((entry) => entries.indexOf(entry));
|
||||
for (const index of prependIndexes) {
|
||||
expect(index).toBeGreaterThanOrEqual(0);
|
||||
}
|
||||
for (let i = 1; i < prependIndexes.length; i += 1) {
|
||||
expect(prependIndexes[i]).toBeGreaterThan(prependIndexes[i - 1]);
|
||||
}
|
||||
const baseIndex = entries.indexOf(basePath);
|
||||
expect(baseIndex).toBeGreaterThanOrEqual(0);
|
||||
for (const index of prependIndexes) {
|
||||
expect(index).toBeLessThan(baseIndex);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user