You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Just following up from our twitter discussion: Code snippet below:
// userService - the module I am testing (condensed version)// injectexports.userService=function(userRepository,validationService,passwordService,deferred,mongojs,lang){return{// methods}};// My test for userService, condensed again but removing all the expectations still causes a failurevarInjector=require('injector');varexpect=require('chai').expect;varsinon=require('sinon');var_=require('lodash');varrepositoryMock=require('../mocks/userRepoMock');varpasswordServiceMock=require('../mocks/passwordServiceMock');describe('userService',function(){varinjector,service,clock,lang;beforeEach(function(done){Injector.create('tripul',{directory: [process.cwd()+'/modules/services/',process.cwd()+'/lang/'],mock: {userRepository: repositoryMock,passwordService: passwordServiceMock}},function(err,_injector){injector=_injector;service=injector.inject('userService');lang=injector.inject('lang');done();});clock=sinon.useFakeTimers();});afterEach(function(){clock.restore();});describe('getting a user',function(){it('should get a user by email',function(){expect(true).to.be.equal(true);});});// The above was working fine before I added a new folder and module called lang. Once I added that as a second member of the directory array it now throws an error:userService"before each" hook:
Uncaught Error: Triedtooverwrite"passwordService".Cannothavetwomoduleswiththesamename.atInjector.register(/Users/simon/Sites/tripul/node_modules/injector/index.js:87:15)atInjector.module(/Users/simon/Sites/tripul/node_modules/injector/index.js:193:23)at/Users/simon/Sites/tripul/node_modules/injector/index.js:55:30at/Users/simon/Sites/tripul/node_modules/injector/node_modules/async/lib/async.js:108:13atArray.forEach(native)at_each(/Users/simon/Sites/tripul/node_modules/injector/node_modules/async/lib/async.js:32:24)atObject.async.each(/Users/simon/Sites/tripul/node_modules/injector/node_modules/async/lib/async.js:107:9)at/Users/simon/Sites/tripul/node_modules/injector/index.js:52:34atfs.js:266:14atObject.oncomplete(fs.js:107:15)
Shout if you need anything else code wise
Thanks!
The text was updated successfully, but these errors were encountered:
Hey,
Just following up from our twitter discussion: Code snippet below:
Shout if you need anything else code wise
Thanks!
The text was updated successfully, but these errors were encountered: