forked from M0009/desktop
-
Notifications
You must be signed in to change notification settings - Fork 0
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
5000fc0
commit 664efe1
Showing
1 changed file
with
29 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { setupEmptyRepository } from '../../helpers/repositories' | ||
import { listWorktrees } from '../../../src/lib/git/worktree' | ||
|
||
describe('git/worktree', () => { | ||
describe('list', () => { | ||
describe('for an unborn repository', () => { | ||
it('returns one entry', async () => { | ||
const repository = await setupEmptyRepository() | ||
const result = await listWorktrees(repository) | ||
expect(result).toHaveLength(1) | ||
}) | ||
|
||
it('contains the head and path of the main repository', async () => { | ||
const repository = await setupEmptyRepository() | ||
const { path } = repository | ||
const result = await listWorktrees(repository) | ||
const first = result[0] | ||
expect(first.head).toBe('0000000000000000000000000000000000000000') | ||
|
||
// You might be wondering why this isn't a `.toBe` comparsion. | ||
// Well, on macOS the path emitted by Git may start with a `/private` | ||
// which is super-annoying and also different to what NodeJS returns, | ||
// so we need to manage and reconcile these two cases | ||
const endsWith = first.path.endsWith(path) | ||
expect(endsWith).toBe(true) | ||
}) | ||
}) | ||
}) | ||
}) |