{"size": 606, "ext": "js", "max_stars_repo_path": "extension/test/unit/user/token/storeWebLoginPhrase-test.js", "max_stars_repo_name": "shopgate/ext-shopify-user", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "extension/test/unit/user/token/storeWebLoginPhrase-test.js", "max_issues_repo_name": "shopgate/ext-shopify-user", "max_issues_repo_issues_event_min_datetime": "2019-04-18T14:08:11.000Z", "max_issues_repo_issues_event_max_datetime": "2019-04-18T14:08:11.000Z", "max_forks_repo_path": "extension/test/unit/user/token/storeWebLoginPhrase-test.js", "max_forks_repo_name": "shopgate/ext-shopify-user", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": 1, "max_forks_count": null, "avg_line_length": 23.3076923077, "max_line_length": 81, "alphanum_fraction": 0.6435643564}
const sinon = require('sinon')
const storeWebLoginPhrase = require('../../../../user/token/storeWebLoginPhrase')

describe('user / token / storeWebLoginPhrase', () => {
  const storage = {
    set: async () => {}
  }
  const context = {
    storage: {
      device: storage
    }
  }

  const input = {
    phrase: 'fancyPhrase'
  }

  it('should store the login phrase in the device storage', async () => {
    const storageSetSpy = sinon.spy(context.storage.device, 'set')

    await storeWebLoginPhrase(context, input)

    sinon.assert.calledWith(storageSetSpy, 'webLoginPhrase', input.phrase)
  })
})
