Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Commit 645ed10

Browse files
committed
GitHub package test coverage
1 parent a5e9e12 commit 645ed10

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

test/github-package.test.js

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -704,6 +704,42 @@ describe('GithubPackage', function() {
704704
});
705705
});
706706

707+
describe('clone', function() {
708+
it('clones into an existing project path', async function() {
709+
const sourcePath = await cloneRepository();
710+
const existingPath = await getTempDir();
711+
project.setPaths([existingPath]);
712+
713+
await contextUpdateAfter(() => githubPackage.activate());
714+
const repository = githubPackage.getActiveRepository();
715+
await repository.getLoadPromise();
716+
assert.isTrue(repository.isEmpty());
717+
718+
assert.isNull(await githubPackage.workdirCache.find(existingPath));
719+
720+
await githubPackage.clone(sourcePath, existingPath);
721+
722+
assert.strictEqual(await githubPackage.workdirCache.find(existingPath), existingPath);
723+
});
724+
725+
it('clones into a new project path', async function() {
726+
const sourcePath = await cloneRepository();
727+
const newPath = await getTempDir();
728+
729+
await contextUpdateAfter(() => githubPackage.activate());
730+
const original = githubPackage.getActiveRepository();
731+
await original.getLoadPromise();
732+
assert.isTrue(original.isAbsentGuess());
733+
assert.deepEqual(project.getPaths(), []);
734+
735+
await contextUpdateAfter(() => githubPackage.clone(sourcePath, newPath));
736+
737+
assert.deepEqual(project.getPaths(), [newPath]);
738+
const replaced = githubPackage.getActiveRepository();
739+
assert.notStrictEqual(original, replaced);
740+
});
741+
});
742+
707743
describe('stub item creation', function() {
708744
beforeEach(function() {
709745
sinon.spy(githubPackage, 'rerender');

0 commit comments

Comments
 (0)