Skip to content

Commit

Permalink
tests(cli): Fix test case on Windows with hardcoded path
Browse files Browse the repository at this point in the history
  • Loading branch information
nellh committed Apr 1, 2024
1 parent 2ea7ebb commit 9702490
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions cli/src/deps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export { join } from "https://deno.land/std@0.212.0/path/join.ts"
export { extname } from "https://deno.land/std@0.212.0/path/extname.ts"
export { basename } from "https://deno.land/std@0.212.0/path/basename.ts"
export { dirname } from "https://deno.land/std@0.212.0/path/dirname.ts"
export { SEPARATOR } from "https://deno.land/std@0.221.0/path/mod.ts"
// Test suites
export {
assert,
Expand Down
8 changes: 4 additions & 4 deletions cli/src/worker/git.test.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { annexRelativePath, hashDirLower, hashDirMixed } from "./git.ts"
import { assertArrayIncludes, assertEquals, git, join, walk } from "../deps.ts"
import { assertArrayIncludes, assertEquals, git, join, walk, SEPARATOR } from "../deps.ts"
import { addGitFiles } from "../commands/upload.ts"
import fs from "node:fs"

Deno.test("annexRelativePath() returns appropriate paths", () => {
assertEquals(annexRelativePath("sub-01/anat/sub-01_T1w.nii.gz"), "../..")
assertEquals(annexRelativePath("sub-01/anat/sub-01_T1w.nii.gz"), join('..', '..'))
})

Deno.test("hashDirLower() returns the correct key prefix", async () => {
Expand Down Expand Up @@ -139,8 +139,8 @@ LICENSE annex.largefiles=nothing`),
includeSymlinks: true,
})
) {
const relativePath = walkEntry.path.split(testRepo + "/")[1]
if (relativePath.startsWith(".git/objects/")) {
const relativePath = walkEntry.path.split(testRepo + SEPARATOR)[1]
if (relativePath.startsWith(`.git${SEPARATOR}objects${SEPARATOR}`)) {
gitObjects += 1
} else {
assertArrayIncludes(expectedFiles, [relativePath])
Expand Down

0 comments on commit 9702490

Please sign in to comment.