"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const user_1 = __importDefault(require("./user"));
test('should create user', () => {
    const user = new user_1.default({ id: 11, name: 'ole', email: 'some@email.com' });
    expect(user.name).toBe('ole');
    expect(user.email).toBe('some@email.com');
    expect(user.imageUrl).toBe('https://gravatar.com/avatar/676212ff796c79a3c06261eb10e3f455aa93998ee6e45263da13679c74b1e674?s=42&d=retro&r=g');
});
test('should create user, all fields', () => {
    const user = new user_1.default({
        id: 11,
        name: 'Admin',
        username: 'admin',
        email: 'some@email.com',
    });
    expect(user.name).toBe('Admin');
    expect(user.username).toBe('admin');
    expect(user.email).toBe('some@email.com');
    expect(user.imageUrl).toBe('https://gravatar.com/avatar/676212ff796c79a3c06261eb10e3f455aa93998ee6e45263da13679c74b1e674?s=42&d=retro&r=g');
});
test('Should create user with only id defined', () => {
    const user = new user_1.default({ id: 123 });
    expect(user.id).toBe(123);
    expect(user.email).toBeUndefined();
    expect(user.username).toBeUndefined();
});
test('Should create user with only email defined', () => {
    const user = new user_1.default({ id: 123, email: 'some@email.com' });
    expect(user.email).toBe('some@email.com');
});
test('Should require valid email', () => {
    expect(() => {
        new user_1.default({ id: 11, email: 'some@' }); // eslint-disable-line
    }).toThrowError(Error('Email "value" must be a valid email'));
});
test('Should create user with only username defined', () => {
    const user = new user_1.default({ id: 133, username: 'some-user' });
    expect(user.username).toBe('some-user');
    expect(user.imageUrl).toBe('https://gravatar.com/avatar/7e90ac329986624ba9929659913354473c6f965d5b559704409e3f933c0643b7?s=42&d=retro&r=g');
});
test('Should create user with only username defined and undefined email', () => {
    const user = new user_1.default({
        id: 1447,
        username: 'some-user',
        email: undefined,
    });
    expect(user.username).toBe('some-user');
});
//# sourceMappingURL=user.test.js.map