SHARE
TWEET

Untitled

a guest Jun 17th, 2019 74 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. let [{key, secret, accessSecret, accessToken}] = await creds.getKeyAndSecret()
  2.      
  3. describe('a credential manager', () => {
  4.     var creds
  5.     before(() => {
  6.         creds = new CredentialManger('twitup-test')
  7.     })
  8.     context('with no existing credentials', () => {
  9.         it('should prompt the user', async () => {
  10.             sinon.stub(inquirer, 'prompt').resolves({key: 'foo', secret: 'bar', accessSecret: 'shot', accessToken: 'batch'})
  11.             let [key, secret, accessSecret, accessToken] = await creds.getKeyAndSecret() // HERE IT IS
  12.             expect(key).to.equal('foo')
  13.             expect(secret).to.equal('bar')
  14.             expect(accessSecret).to.equal('shot')
  15.             expect(accessToken).to.equal('batch')
  16.             expect(inquirer.prompt.calledOnce).to.be.true
  17.             inquirer.prompt.restore()
  18.         })
  19.     })
  20.     context('with existing credentials', () => {
  21.         it('should just return them', async () => {
  22.             let [key, secret, accessSecret, accessToken] = await creds.getKeyAndSecret() // AND THERE IS NOT
  23.             expect(key).to.equal('foo')
  24.             expect(secret).to.equal('bar')
  25.             expect(accessSecret).to.equal('shot')
  26.             expect(accessToken).to.equal('batch')
  27.         })
  28.     })
  29.      
  30. a credential manager
  31.     with no existing credentials
  32.       ✓ should prompt the user (61ms)
  33.     with existing credentials
  34.       1) should just return them
  35.  
  36.  
  37.   1 passing (271ms)
  38.   1 failing
  39.  
  40.   1) a credential manager
  41.        with existing credentials
  42.          should just return them:
  43.      AssertionError: expected { Object (key, secret, ...) } to equal 'foo'
  44.       at Context.<anonymous> (test/credential-manager.js:27:28)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top