/*
 * Copyright (C) 2018 Robert Bosch GmbH Copyright (C) 2018 Robert Bosch Manufacturing Solutions GmbH, Germany. All rights reserved.
 */

import { User } from './user';

describe('User', () => {
  it('should be created', () => {
    const user: User = new User('1', 'Alfons', 'User', 'QA', 'Alfons@company.com');
    expect(user.id).toBe('1');
    expect(user.name).toBe('Alfons');
  });

  it('should compare equal', () => {
    const user: User = new User('1', 'Alfons', 'User', 'QA', 'Alfons@company.com');
    const userToCompare: User = new User('2', 'Bert', 'User', 'QA', 'Bert@company.com');
    // 'id 2 should be greater than id 1'
    expect(userToCompare.compare(user, 'id')).toBeGreaterThan(0);
    // 'Bert should be greater than Alfons'
    expect(userToCompare.compare(user, 'name')).toBeGreaterThan(0);
    // 'role [User] should be equal to role [User]'
    expect(userToCompare.compare(user, 'role')).toBe(0);
  });
});
