Created
May 5, 2016 19:44
-
-
Save mfdeveloper/15bc71981615475f15333156012225e4 to your computer and use it in GitHub Desktop.
inquirer-npm-name unit test initial changes but doesn't works. Needs verify if is necessary use of "mocha" or "chai" npm packages
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe('npm validation logic (inquirer `when` function)', function () { | |
beforeEach(function () { | |
askName2 = proxyquire('../lib', { | |
'npm-name': function(name){ | |
return Promise.resolve(name == 'yo'); | |
} | |
}); | |
it('ask question if npm name is taken', function (done) { | |
this.inquirer.prompt.returns(Promise.resolve({name:'yo'})); | |
return askName2(this.conf, this.inquirer).then(function(props){ | |
this.when = this.inquirer.prompt.getCall(0).args[0][1].when; | |
console.log(this.when); | |
this.when.call({name: 'yo'}).then(function(shouldAsk){ | |
assert.ok(shouldAsk); | |
/*Problems with timeout to sincronize | |
* with async Promise here using done(); | |
* | |
* Verify the possibility of use the "mocha" | |
* and/or "chai" npm packages | |
*/ | |
done(); | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment