-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Follow directions in the VS Code API docs for relative paths
- Loading branch information
1 parent
350d9b3
commit 7fdd5f3
Showing
5 changed files
with
67 additions
and
11 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { join, resolve } from 'path' | ||
import { afterEach, beforeEach, describe, it, suite } from 'mocha' | ||
import { expect } from 'chai' | ||
import { Uri } from 'vscode' | ||
import { Disposable } from '@hediet/std/disposable' | ||
import { restore } from 'sinon' | ||
import { getRelativePattern } from '../../../fileSystem/watcher' | ||
import { dvcDemoPath, getTestWorkspaceFolder } from '../../util' | ||
|
||
suite('File System Watcher Test Suite', () => { | ||
const disposable = Disposable.fn() | ||
|
||
beforeEach(() => { | ||
restore() | ||
}) | ||
|
||
afterEach(() => { | ||
disposable.dispose() | ||
}) | ||
|
||
describe('getRelativePattern', () => { | ||
it('should return the expected relative pattern with a path inside of the workspace', () => { | ||
const relativePattern = getRelativePattern( | ||
join(dvcDemoPath, '.git'), | ||
'**' | ||
) | ||
expect(relativePattern.baseUri).to.deep.equal( | ||
getTestWorkspaceFolder().uri | ||
) | ||
expect(relativePattern.pattern).equal(join('.git', '**')) | ||
}) | ||
|
||
it('should return the expected relative pattern for a path outside of the workspace', () => { | ||
const path = resolve(dvcDemoPath, '..', '.git') | ||
const relativePattern = getRelativePattern(path, '**') | ||
expect(relativePattern.baseUri.path).to.equal(Uri.file(path).path) | ||
expect(relativePattern.pattern).to.equal('**') | ||
}) | ||
}) | ||
}) |
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