Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
test( 'Builder.init', function( t ) {
t.plan( 2 );
var Builder = proxyquireStrict(
'out',
{
'./platforms' : {}
}
);
t.is( typeof Builder.init, 'function' );
t.is( typeof Builder.init().build, 'function' );
} );
test.cb( 'Builder.init().build - call the correct platform', function( t ) {
t.plan( 2 );
var Builder = proxyquireStrict(
'out',
{
'./platforms' : function( platform ) {
if ( platform === 'bar' ) {
return {
init : function() {
return {
build : function( options, callback ) {
callback( null, 'foo' )
}
};
}
};
{
appPath : 'foo',
basePath : 'bar',
platform : 'bar',
config : { bar : {} },
log : function() {}
},
function( error, result ) {
t.is( error, null );
t.is( result, 'foo' );
t.end();
}
);
} );
test.cb( 'Builder.init().build - create output directory if not present', function( t ) {
t.plan( 1 );
var tmpDir = tmp.dirSync( { unsafeCleanup : true } );
var Builder = proxyquireStrict(
'out',
{
'./platforms' : function( platform ) {
if ( platform === 'bar' ) {
return {
init : function() {
return {
build : function( options, callback ) {
callback( null, 'foo' )
}
};
}