<commit_before>import * as assert from 'power-assert'
import {User as UserClass} from '../../src/controllers/user'
import {Chance, Run, Support} from '../assets'

const User = new UserClass()

describe('createUser', () => {
  it('create with name', (done) => {
    Run(async () => {
      const username = Chance.first()
      const password = <PASSWORD>.string()
      const user = await User.createUser({username, password})
      assert(user.id)
      assert(user.token)
    }, done)
  })
  it('create with email', (done) => {
    Run(async () => {
      const email = Chance.email()
      const password = <PASSWORD>.string()
      const user = await User.createUser({email, password})
      assert(user.id)
      assert(user.token)
    }, done)
  })
})

describe('signin', () => {
  it('signin with username', (done) => {
    Run(async () => {
      const normalUser = await Support.getNormalUser()
      const user = await User.signin({
        password: <PASSWORD>,
        username: normalUser.username,
      })
      assert.equal(user.id, normalUser.id)
      assert.equal(user.token, normalUser.token)
    }, done)
  })

  it('signin with email', (done) => {
    Run(async () => {
      const normalUser = await Support.getNormalUser()
      const user = await User.signin({
        password: <PASSWORD>,
        username: normalUser.email,<commit_msg>test: modify signup test cases<commit_after>import * as assert from 'power-assert'
import {User as UserClass} from '../../src/controllers/user'
import {Chance, Run, Support} from '../assets'

const User = new UserClass()

describe('signup', () => {
  it('signup with name', (done) => {
    Run(async () => {
      const username = Chance.first()
      const password = <PASSWORD>.<PASSWORD>()
      const user = await User.signup({username, password})
      assert(user.id)
      assert(user.token)
    }, done)
  })
  it('signup with email', (done) => {
    Run(async () => {
      const email = Chance.email()
      const password = <PASSWORD>()
      const user = await User.signup({email, password})
      assert(user.id)
      assert(user.token)
    }, done)
  })
})

describe('signin', () => {
  it('signin with username', (done) => {
    Run(async () => {
      const normalUser = await Support.getNormalUser()
      const user = await User.signin({
        password: <PASSWORD>,
        username: normalUser.username,
      })
      assert.equal(user.id, normalUser.id)
      assert.equal(user.token, normalUser.token)
    }, done)
  })

  it('signin with email', (done) => {
    Run(async () => {
      const normalUser = await Support.getNormalUser()
      const user = await User.signin({
        password: <PASSWORD>,
        username: normalUser.email,
{'fraction_non_alphanumeric': 0.1590909090909091, 'fraction_numerical': 0.0, 'mean_word_length': 2.7797783933518008, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 32, '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': '3362017', 'n_tokens_mistral': 833, 'n_tokens_neox': 824, 'n_words': 203}