<commit_before>'use strict'
const Promise = require('bluebird')
const db = require('APP/db')
    , {User, Address} = db
    , {expect} = require('chai')

/* global describe it before afterEach */

describe('User', () => {
  before('Await database sync', () => db.didSync)
  afterEach('Clear the tables', () => db.truncate({ cascade: true }))

  describe('authenticate(plaintext: String) ~> Boolean', () => {
    let testUser

    before(done => {
      User.create({ email: '<EMAIL>', password: 'ok' })
        .then(res => {
          testUser = res
          done()
        })
    })

    it('resolves true if the password matches', () => {
      testUser.authenticate('ok')
      .then(result => expect(result).to.be.true)
      .catch(err => console.error('error authenticating user password', err))
    })

    it("resolves false if the password doesn't match", () => {
      testUser.authenticate('not ok')
      .then(result => expect(result).to.be.false)
      .catch(err => console.error('error authenticating user password', err))
    })
  })

  describe('isGuest option method', () => {
    it('returns true if password does not exist', () => {
      User.create({email: '<EMAIL>'})
        .then(guestUser => expect(guestUser.isGuest).to.be.true)
    })
  })

  describe('User Associations', () => {
    before(done => {
      const creatingUser = User.create({email: '<EMAIL>'})
      const creatingAddress = Address.create({country: 'USA', firstName: '<NAME>', lastName: 'Kido', administrativeArea: 'NY', locality: 'NYC', postalZipCode: '12345', streetAddress: '123 Kido Lane'})

      Promise.all([creatingUser, creatingAddress])
      .spread((user, address) => {
        user.addShippingInfo([address])
        user.addBillingInfo([address])
        done()
      })
    })

    it('sets billing association correctly', () => {
      User.findOne({where: {
        email: 'k<EMAIL>'
      }})
      .then(user => user.getBillingInfo())
      .then(billingInfo => {
        expect(billingInfo.length).to.equal(1)
        expect(billingInfo[0].fullName).to.equal('<NAME>')
      })
    })
  })
})
<commit_msg>test issues<commit_after>'use strict'
const Promise = require('bluebird')
const db = require('APP/db')
    , {User, Address} = db
    , {expect} = require('chai')

/* global describe it before afterEach */

describe('User', () => {
  before('Await database sync', () => db.didSync)
  afterEach('Clear the tables', () => db.truncate({ cascade: true }))

  describe('authenticate(plaintext: String) ~> Boolean', () => {
    it('resolves true if the password matches', () => {
      User.create({ email: '<EMAIL>', password: 'ok' })
        .then(user => user.authenticate('ok'))
        .then(result => expect(result).to.be.true)
    })

    it("resolves false if the password doesn't match", () => {
      User.create({ email: '<EMAIL>', password: 'ok' })
        .then(user => user.authenticate('not ok'))
        .then(result => expect(result).to.be.false)
    })
  })

  describe('isGuest option method', () => {
    it('returns true if password does not exist', () => {
      User.create({email: '<EMAIL>'})
        .then(guestUser => expect(guestUser.isGuest).to.be.true)
    })
  })

  describe('User Associations', () => {
    before(done => {
      const creatingUser = User.create({email: '<EMAIL>'})
      const creatingAddress = Address.create({country: 'USA', firstName: '<NAME>', lastName: 'Kido', administrativeArea: 'NY', locality: 'NYC', postalZipCode: '12345', streetAddress: '123 Kido Lane'})

      Promise.all([creatingUser, creatingAddress])
      .spread((user, address) => {
        user.addShippingInfo([address])
        user.addBillingInfo([address])
        done()
      })
    })

    it('sets billing association correctly', () => {
      User.findOne({where: {
        email: '<EMAIL>'
      }})
      .then(user => user.getBillingInfo())
      .then(billingInfo => {
        expect(billingInfo.length).to.equal(1)
        expect(billingInfo[0].fullName).to.equal('<NAME>')
      })
    })
  })
})

{'fraction_non_alphanumeric': 0.18567901234567902, 'fraction_numerical': 0.0049382716049382715, 'mean_word_length': 3.0268389662027833, 'pattern_counts': {'":': 0, '<': 16, '<?xml version=': 0, '>': 58, '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': '3071688', 'n_tokens_mistral': 1290, 'n_tokens_neox': 1236, 'n_words': 257}