Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let [{key, secret, accessSecret, accessToken}] = await creds.getKeyAndSecret()
- describe('a credential manager', () => {
- var creds
- before(() => {
- creds = new CredentialManger('twitup-test')
- })
- context('with no existing credentials', () => {
- it('should prompt the user', async () => {
- sinon.stub(inquirer, 'prompt').resolves({key: 'foo', secret: 'bar', accessSecret: 'shot', accessToken: 'batch'})
- let [key, secret, accessSecret, accessToken] = await creds.getKeyAndSecret() // HERE IT IS
- expect(key).to.equal('foo')
- expect(secret).to.equal('bar')
- expect(accessSecret).to.equal('shot')
- expect(accessToken).to.equal('batch')
- expect(inquirer.prompt.calledOnce).to.be.true
- inquirer.prompt.restore()
- })
- })
- context('with existing credentials', () => {
- it('should just return them', async () => {
- let [key, secret, accessSecret, accessToken] = await creds.getKeyAndSecret() // AND THERE IS NOT
- expect(key).to.equal('foo')
- expect(secret).to.equal('bar')
- expect(accessSecret).to.equal('shot')
- expect(accessToken).to.equal('batch')
- })
- })
- a credential manager
- with no existing credentials
- ✓ should prompt the user (61ms)
- with existing credentials
- 1) should just return them
- 1 passing (271ms)
- 1 failing
- 1) a credential manager
- with existing credentials
- should just return them:
- AssertionError: expected { Object (key, secret, ...) } to equal 'foo'
- at Context.<anonymous> (test/credential-manager.js:27:28)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement