Skip to content

Commit

Permalink
Added some more core tests
Browse files Browse the repository at this point in the history
  • Loading branch information
doctorrustynelson committed Apr 20, 2015
1 parent e2156d3 commit 784292f
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 3 deletions.
36 changes: 35 additions & 1 deletion tests/core-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ var path = require( 'path' );
module.exports.determineYearningPathTests = {

setUp: function( callback ){
core.init( require( '../lib/utils/config' )( { orgs: { '': path.resolve( __dirname, 'node_modules' ) } } ) );
core.init( require( '../lib/utils/config' )( { orgs: { '': path.resolve( __dirname, 'node_modules' ), 'test': path.resolve( __dirname, 'node_modules' ) } } ) );
callback( );
},

Expand All @@ -43,6 +43,40 @@ module.exports.determineYearningPathTests = {
var result = core.determineYearningPath( { module: 'test-module-0' }, { id: path.resolve( __dirname, 'test-package.jsons', 'package.json' ) } );
test.equal( result, path.resolve( __dirname, 'node_modules', 'test-module-0', '1.1.0' ) );

test.done( );
},

otherOrgYearning: function( test ){

var result = core.determineYearningPath( { module: 'test-module-2' }, { id: path.resolve( __dirname, 'test-package.jsons', 'package.json' ) } );
test.equal( result, path.resolve( __dirname, 'node_modules', 'test-module-2', '1.0.0' ) );

test.done( );
},

noPackage: function( test ){

test.throws( function( ){
core.determineYearningPath( { module: 'test-module-0' }, { id: path.resolve( '/' ) } );
} );

test.done( );
},

noKnowOrg: function( test ){

var result = core.determineYearningPath( { module: 'test-module-3', version: '1.x.x' }, { id: path.resolve( __dirname, 'test-package.jsons', 'package.json' ) } );
test.equal( result, path.resolve( __dirname, 'node_modules', 'test-module-3', '1.1.0' ) );

test.done( );
},

noKnowVersion: function( test ){

test.throws( function( ){
core.determineYearningPath( { module: 'test-module-3' }, { id: path.resolve( __dirname, 'test-package.jsons', 'package.json' ) } );
} );

test.done( );
}
};
Expand Down
3 changes: 1 addition & 2 deletions tests/test-package.jsons/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"dependencies": {
"test-module-0": "1.x.x",
"test-module-1": "1.x.x",
"test-module-2": "1.x.x",
"test-module-3": "1.x.x"
"test:test-module-2": "1.x.x"
}
}

0 comments on commit 784292f

Please sign in to comment.