-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2e11e47
commit 1009894
Showing
12 changed files
with
200 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import path from 'node:path'; | ||
import assert from 'node:assert/strict'; | ||
import { describe, it } from 'vitest'; | ||
import { | ||
findEtherpadRoot, | ||
makeAbsolute, | ||
isSubdir, | ||
} from '@/utils/backend/AbsolutePaths'; | ||
|
||
describe('AbsolutePaths', () => { | ||
it('findEtherpadRoot - returns current working directory if etherpadRoot is not set', () => { | ||
const originalCwd = process.cwd(); | ||
const result = findEtherpadRoot(); | ||
assert.equal(result, originalCwd); | ||
}); | ||
|
||
it('makeAbsolute - returns absolute path if already absolute', () => { | ||
const absolutePath = '/some/absolute/path'; | ||
const result = makeAbsolute(absolutePath); | ||
assert.equal(result, absolutePath); | ||
}); | ||
|
||
it('isSubdir - returns true for a subdirectory', () => { | ||
const parent = '/parent/directory'; | ||
const subdirectory = '/parent/directory/subdir'; | ||
const result = isSubdir(parent, subdirectory); | ||
assert.strictEqual(result, true); | ||
}); | ||
|
||
it('isSubdir - returns false for a directory outside parent', () => { | ||
const parent = '/parent/directory'; | ||
const outsideDirectory = '/outside/directory'; | ||
const result = isSubdir(parent, outsideDirectory); | ||
assert.strictEqual(result, false); | ||
}); | ||
|
||
it('isSubdir - returns false for parent equal to arbitrary directory', () => { | ||
const directory = '/some/directory'; | ||
const result = isSubdir(directory, directory); | ||
assert.strictEqual(result, false); | ||
}); | ||
}); |
Oops, something went wrong.