1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-25 00:07:47 +01:00
unleash.unleash/lib/user.test.js
Ivar Conradi Østhus d01c9d2dac
fix: use airbnb lint rules directly (#583)
This drops usage of finn-eslint rules as they are no
longer maintained.
2020-04-14 22:29:11 +02:00

32 lines
791 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,
'https://gravatar.com/avatar/d8ffeba65ee5baf57e4901690edc8e1b?size=42&default=retro',
);
});
test('should require email', t => {
const error = t.throws(
() => {
const user = new User(); // eslint-disable-line
},
{ instanceOf: 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');
});