File tree Expand file tree Collapse file tree 3 files changed +41
-58
lines changed Expand file tree Collapse file tree 3 files changed +41
-58
lines changed Original file line number Diff line number Diff line change 6767 "host" : " https://s3.amazonaws.com/nodegit/nodegit/"
6868 },
6969 "scripts" : {
70- "lint" : " jshint lib test/tests/*.js " ,
70+ "lint" : " jshint lib test/tests" ,
7171 "mocha" : " istanbul cover _mocha -- test/runner test/tests --report=lcov" ,
7272 "test" : " npm run lint && npm run mocha" ,
7373 "publish" : " node-pre-gyp package && node-pre-gyp publish" ,
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ var assert = require ( "assert" ) ;
2+ var path = require ( "path" ) ;
3+
4+ describe ( "Repository" , function ( ) {
5+ var reposPath = path . resolve ( "test/repos/workdir/.git" ) ;
6+
7+ var Repository = require ( "../../lib/repository" ) ;
8+
9+ before ( function ( ) {
10+ var test = this ;
11+
12+ return Repository . open ( reposPath ) . then ( function ( repository ) {
13+ test . repository = repository ;
14+ } ) ;
15+ } ) ;
16+
17+ it ( "can open a valid repository" , function ( ) {
18+ assert . ok ( this . repository instanceof Repository ) ;
19+ } ) ;
20+
21+ it ( "cannot open an invalid repository" , function ( ) {
22+ return Repository . open ( "repos/nonrepo" ) . then ( null , function ( err ) {
23+ assert . ok ( err instanceof Error ) ;
24+ } ) ;
25+ } ) ;
26+
27+ it ( "does not try to open paths that don't exist" , function ( ) {
28+ var missingPath = "/surely/this/directory/does/not/exist/on/this/machine" ;
29+
30+ return Repository . open ( missingPath ) . then ( null , function ( err ) {
31+ assert . ok ( err instanceof Error ) ;
32+ } ) ;
33+ } ) ;
34+
35+ it ( "can initialize a repository into a folder" , function ( ) {
36+ return Repository . init ( "repos/newrepo" , 1 ) . then ( function ( path , isBare ) {
37+ return Repository . open ( "repos/newrepo" ) ;
38+ } ) ;
39+ } ) ;
40+ } ) ;
You can’t perform that action at this time.
0 commit comments