@@ -704,6 +704,42 @@ describe('GithubPackage', function() {
704
704
} ) ;
705
705
} ) ;
706
706
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
+
707
743
describe ( 'stub item creation' , function ( ) {
708
744
beforeEach ( function ( ) {
709
745
sinon . spy ( githubPackage , 'rerender' ) ;
0 commit comments