1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-28 00:06:53 +01:00
unleash.unleash/lib/user.test.js
2018-01-17 15:36:38 +01:00

29 lines
740 B
JavaScript

'use strict';
const { test } = require('ava');
const User = require('./user');
test('should create user', t => {
const user = new User({ name: 'ole', email: 'some@email.com' });
t.is(user.name, 'ole');
t.is(user.email, 'some@email.com');
t.is(
user.imageUrl,
'//www.gravatar.com/avatar/d8ffeba65ee5baf57e4901690edc8e1b?s=42&d=retro'
);
});
test('should require email', t => {
const error = t.throws(() => {
const user = new User(); // eslint-disable-line
}, Error);
t.is(error.message, 'Email "value" is required');
});
test('Should create user with only email defined', t => {
const user = new User({ email: 'some@email.com' });
t.is(user.email, 'some@email.com');
});