From 28164b7a769b703519eae2f80d47a1765bfb3a0d Mon Sep 17 00:00:00 2001
From: OZGCloud <ozgcloud@mgm-tp.com>
Date: Mon, 8 Nov 2021 13:32:32 +0100
Subject: [PATCH] OZG-1389 add test

---
 .../lib/user-icon/user-icon.component.spec.ts | 27 ++++++++++++++++++-
 1 file changed, 26 insertions(+), 1 deletion(-)

diff --git a/goofy-client/libs/user-profile/src/lib/user-icon/user-icon.component.spec.ts b/goofy-client/libs/user-profile/src/lib/user-icon/user-icon.component.spec.ts
index 3accffb4bb..39234ad690 100644
--- a/goofy-client/libs/user-profile/src/lib/user-icon/user-icon.component.spec.ts
+++ b/goofy-client/libs/user-profile/src/lib/user-icon/user-icon.component.spec.ts
@@ -1,7 +1,8 @@
 import { ComponentFixture, TestBed } from '@angular/core/testing';
 import { MatIcon } from '@angular/material/icon';
 import { MatTooltipModule } from '@angular/material/tooltip';
-import { createStateResource } from '@goofy-client/tech-shared';
+import { createEmptyStateResource, createStateResource } from '@goofy-client/tech-shared';
+import { getElementFromFixture } from '@goofy-client/test-utils';
 import { createUserProfileResource } from 'libs/user-profile-shared/test/user-profile';
 import { UserIconComponent } from './user-icon.component';
 
@@ -9,6 +10,9 @@ describe('UserIconComponent', () => {
 	let component: UserIconComponent;
 	let fixture: ComponentFixture<UserIconComponent>;
 
+	const profileAssignedIcon: string = '[data-test-id="user-profile-assigned"]';
+	const profileUnassigned: string = '[data-test-id="user-profile-unassigned"]';
+
 	beforeEach(async () => {
 		await TestBed.configureTestingModule({
 			imports: [MatTooltipModule],
@@ -29,4 +33,25 @@ describe('UserIconComponent', () => {
 	it('should create', () => {
 		expect(component).toBeTruthy();
 	});
+
+	describe('on icon place', () => {
+
+		it('should show icon unassigned', () => {
+			component.userProfileStateResource = createEmptyStateResource();
+
+			fixture.detectChanges();
+			const element = getElementFromFixture(fixture, profileUnassigned);
+
+			expect(element).toBeInstanceOf(HTMLElement);
+		})
+
+		it('should show icon assigned', () => {
+			component.userProfileStateResource = createStateResource(createUserProfileResource());
+
+			fixture.detectChanges();
+			const element = getElementFromFixture(fixture, profileAssignedIcon);
+
+			expect(element).toBeInstanceOf(HTMLElement);
+		})
+	})
 });
-- 
GitLab