UNPKG

warp.firstclass

Version:

Allows to access all your modules directly like: require('moduleName') by creating symlinks

33 lines (22 loc) 694 B
var expect = require('expect'); var firstClass = require('../index.js'); var fs = require('fs'); describe('warp.firstClass', function(){ it('should create a symlink', function(done){ expect(requireModels).toThrow(); firstClass.link('./test/lib').then(function(){ var models = requireModels(); expect(models).toBeA('function'); fs.unlinkSync('./node_modules/models'); done(); }); }); it('should throw if no correct arguments are passed', function(){ expect(function(){ firstClass.link(); }).toThrow(); }); }); function requireModels(){ return require('models/'); }