Moved spec files to external folder

Change-Id: Idf6489dd0e385764c17e5d9b1b831d7d9fae448c
diff --git a/spec/components/hello.spec.ts b/spec/components/hello.spec.ts
new file mode 100644
index 0000000..44420ac
--- /dev/null
+++ b/spec/components/hello.spec.ts
@@ -0,0 +1,57 @@
+/// <reference path="../../typings/index.d.ts"/>
+
+import {Router} from '@angular/router';
+import {HelloComponent} from '../../src/app/hello';
+import {LogoutComponent} from '../../src/app/components/logout/logout.component';
+import {StyleConfig} from '../../src/app/config/style.config';
+import { Http, BaseRequestOptions } from '@angular/http';
+import {CookieService} from 'angular2-cookie/services/cookies.service';
+import {XosHttp} from '../../src/app/services/rest/xoshttp.service';
+import {InstanceStore} from '../../src/app/services/stores/instance.store';
+import {GlobalEvent} from '../../src/app/services/websockets/websocket.global';
+import {AuthService} from '../../src/app/services/rest/auth.service';
+import {InstanceService} from '../../src/app/services/rest/instance.service';
+import {SliceService} from '../../src/app/services/rest/slices.service';
+import {TestBed, async} from '@angular/core/testing';
+import {MockBackend} from '@angular/http/testing';
+
+describe('hello component', () => {
+  beforeEach(async(() => {
+    TestBed.configureTestingModule({
+      declarations: [
+        HelloComponent,
+        LogoutComponent
+      ],
+      providers: [
+        {
+          provide: Http,
+          useFactory: (mockBackend, options) => {
+            return new Http(mockBackend, options);
+          },
+          deps: [MockBackend, BaseRequestOptions]
+        },
+        MockBackend,
+        BaseRequestOptions,
+        CookieService,
+        {
+          provide: Router,
+          useClass: class { navigate = jasmine.createSpy('navigate'); }
+        },
+        XosHttp,
+        InstanceStore,
+        GlobalEvent,
+        AuthService,
+        InstanceService,
+        SliceService
+      ]
+    });
+    TestBed.compileComponents();
+  }));
+
+  it('should render hello world', () => {
+    const fixture = TestBed.createComponent(HelloComponent);
+    fixture.detectChanges();
+    const hello = fixture.nativeElement;
+    expect(hello.querySelector('h1').textContent).toBe(`Hello ${StyleConfig.projectName}!`);
+  });
+});
diff --git a/spec/services/store.service.spec.ts b/spec/services/store.service.spec.ts
new file mode 100644
index 0000000..a477817
--- /dev/null
+++ b/spec/services/store.service.spec.ts
@@ -0,0 +1,89 @@
+///<reference path="../../typings/globals/jasmine/index.d.ts"/>
+
+import {ObservableCollectionHandler} from '../../src/app/services/helpers/store.service';
+import {IWSEvent} from '../../src/app/interfaces/ws.interface';
+import {BehaviorSubject} from 'rxjs';
+
+describe('Service: Observable Collection Handler', () => {
+
+  let subject: BehaviorSubject<any>;
+  let observable;
+
+  beforeEach(() => {
+    subject = new BehaviorSubject([]);
+    observable = subject.asObservable();
+  });
+
+  it('Should have an update method', () => {
+    expect(ObservableCollectionHandler.update).toBeDefined();
+  });
+
+  it('should add an element to the observable', (done) => {
+    const event: IWSEvent = {
+      model: 'Test',
+      msg: {
+        pk: 1,
+        changed_fields: [],
+        object: {id: 1, foo: 'bar'}
+      }
+    };
+
+    ObservableCollectionHandler.update(event, subject);
+
+    subject.subscribe(
+      (collection: any[]) => {
+        expect(collection.length).toBe(1);
+        expect(collection[0].foo).toEqual('bar');
+        done();
+      }
+    );
+  });
+
+  describe('when the subject already have content', () => {
+    beforeEach(() => {
+      subject.next([{id: 1, foo: 'bar'}, {id: 2, foo: 'baz'}]);
+    });
+
+    it('should update an element', (done) => {
+      const event: IWSEvent = {
+        model: 'Test',
+        msg: {
+          pk: 1,
+          changed_fields: [],
+          object: {id: 1, foo: 'updated'}
+        }
+      };
+
+      ObservableCollectionHandler.update(event, subject);
+
+      subject.subscribe(
+        (collection: any[]) => {
+          expect(collection.length).toBe(2);
+          expect(collection[0].foo).toEqual('updated');
+          done();
+        }
+      );
+    });
+
+    it('should delete an element', (done) => {
+      const event: IWSEvent = {
+        model: 'Test',
+        msg: {
+          pk: 1,
+          changed_fields: ['deleted'],
+          object: {id: 1, foo: 'deleted'}
+        }
+      };
+
+      ObservableCollectionHandler.update(event, subject);
+
+      subject.subscribe(
+        (collection: any[]) => {
+          expect(collection.length).toBe(1);
+          expect(collection[0].foo).toEqual('baz');
+          done();
+        }
+      );
+    });
+  });
+});