<commit_before>import test from 'ava'

import authenticator from '../src/authenticator'
import testUsers from './util/testUsers'

function localUsersRepository () {
  return {
    getUser(id) {
      const result = testUsers.find((user) => user.id === id)
      if (!result) {
        return Promise.reject(new Error('User not found'))
      }
      return Promise.resolve(result)
    }
  }
}

function make () {
  return authenticator({
    secret: 'TEST',
    users: localUsersRepository()
  })
}

test('getAuthBlurb promises a string', async (t) => {
  const auth = make()
  const user = testUsers[0]
  const promise = auth.getAuthBlurb(user.id)
  t.true(promise instanceof Promise)
  const result = await promise
  t.is(typeof result, 'object')
  t.is(typeof result.blurb, 'string')
})
<commit_msg>Fix test for getAuthBlurb() result<commit_after>import test from 'ava'

import authenticator from '../src/authenticator'
import testUsers from './util/testUsers'

function localUsersRepository () {
  return {
    getUser(id) {
      const result = testUsers.find((user) => user.id === id)
      if (!result) {
        return Promise.reject(new Error('User not found'))
      }
      return Promise.resolve(result)
    }
  }
}

function make () {
  return authenticator({
    secret: 'TEST',
    users: localUsersRepository()
  })
}

test('getAuthBlurb promises a string', async (t) => {
  const auth = make()
  const user = testUsers[0]
  const promise = auth.getAuthBlurb(user.id)
  t.is(typeof promise.then, 'function')
  const result = await promise
  t.is(typeof result, 'object')
  t.is(typeof result.blurb, 'string')
})

{'fraction_non_alphanumeric': 0.13513513513513514, 'fraction_numerical': 0.0012285012285012285, 'mean_word_length': 3.4508196721311477, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '126853', 'n_tokens_mistral': 510, 'n_tokens_neox': 507, 'n_words': 136}