<commit_before>var test = require('tape')
var nock = require('nock')

var Account = require('../../index')

var baseURL = 'http://localhost:3000'
var signUpResponse = require('../fixtures/signup.json')
var signInResponse = require('../fixtures/signin.json')
var options = {
  username: signUpResponse.data.attributes.username,
  password: '<PASSWORD>'
}

test('returns correct signedIn state', function (t) {
  t.plan(2)

  var account = new Account({
    url: baseURL
  })

  nock(baseURL)
    .put('/session/account')
    .reply(200, signUpResponse)
    .put('/session')
    .reply(201, signInResponse)
    .delete('/session')
    .reply(204)

  account.signUp(options)

  .then(function () {
    return account.signIn(options)
  })

  .then(function () {
    t.is(account.isSignedIn(), true, 'returns true after signIn()')

    return account.signOut()
  })

  .then(function () {
    t.is(account.isSignedIn(), false, 'returns false after signOut()')
  })

  .catch(t.error)
})<commit_msg>refactor: unit-ify isSignedIn test<commit_after>var test = require('tape')

var isSignedIn = require('../../lib/is-signed-in')

test('isSignedIn without session', function (t) {
  t.is(isSignedIn({}), false, 'returns false')

  t.end()
})

test('isSignedIn with session', function (t) {
  t.is(isSignedIn({
    session: {}
  }), true, 'returns true')

  t.end()
})
{'fraction_non_alphanumeric': 0.18054532056005895, 'fraction_numerical': 0.010316875460574797, 'mean_word_length': 3.7482517482517483, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '647533', 'n_tokens_mistral': 485, 'n_tokens_neox': 465, 'n_words': 97}