cluedin-widget
Version:
This is the project for creating and managing widgets in CluedIn.
31 lines (26 loc) • 1.13 kB
JavaScript
require( 'should' );
var fs = require( 'fs' );
var widgetFileBuilder = require( '../src/widgetFileBuilder' );
var fileNameBuilder = require( '../src/fileNameBUilder' );
var contentResult = "import '../widget/onBoarding/index.jsx';import '../widget/test/index.jsx';import '../core/components/bootstrap.jsx';";
describe( 'Given a widgetFileBUilder', function() {
it( 'should exist', function() {
widgetFileBuilder.should.exist;
} );
it( 'should have a build method', function() {
widgetFileBuilder.build.should.exist;
} );
it( 'build method should return a content', function( done ) {
var sut = fileNameBuilder.getFileName( 'test' );
widgetFileBuilder.build( {
fileName: sut,
widgets: [ 'onBoarding', 'test' ]
}, function( err, fileName ) {
fileName.should.exist;
fileName.should.equal( '/Users/dervalp/src/cluedin-widget/temp/test.js' );
var content = fs.readFileSync( fileName ).toString();
content.should.equal( contentResult );
done();
} );
} );
} );