UNPKG

677 BJavaScriptView Raw
1'use strict'
2
3/* global describe, it */
4
5const expect = require('chai').expect
6const User = require('../src/user')
7
8describe('User', () =>
9 describe('new', function () {
10 it('uses id as the default name', function () {
11 const user = new User('hubot')
12
13 expect(user.name).to.equal('hubot')
14 })
15
16 it('sets attributes passed in', function () {
17 const user = new User('hubot', { foo: 1, bar: 2 })
18
19 expect(user.foo).to.equal(1)
20 expect(user.bar).to.equal(2)
21 })
22
23 it('uses name attribute when passed in, not id', function () {
24 const user = new User('hubot', { name: 'tobuh' })
25
26 expect(user.name).to.equal('tobuh')
27 })
28 })
29)