This repository has been archived by the owner on Oct 9, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8525c29
commit 7e10aac
Showing
4 changed files
with
69 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,35 @@ | ||
import { ChatService } from "./chat.service"; | ||
import { Injector } from '@angular/core'; | ||
import { TestBed, inject } from '@angular/core/testing'; | ||
import { HttpModule, Http, XHRBackend } from '@angular/http'; | ||
import { MockBackend } from '@angular/http/testing'; | ||
|
||
import { ChatService, ConnectionState } from "./chat.service"; | ||
|
||
import { Settings } from './settings'; | ||
import { User } from './user'; | ||
import { Message } from './message'; | ||
import { Conversation } from './conversation'; | ||
|
||
describe('ChatService', () => { | ||
it("start should return connectionState observable", () => { | ||
let settings = new Settings(); | ||
|
||
|
||
beforeEach(() => { | ||
TestBed.configureTestingModule({ | ||
imports: [HttpModule], | ||
providers: [ | ||
{ provide: XHRBackend, useClass: MockBackend } | ||
] | ||
}); | ||
}); | ||
|
||
it("start should return connectionState observable", inject([Settings, Http], (settings: Settings, http: Http) => { | ||
let service = new ChatService(settings, http); | ||
let connectionState: ConnectionState; | ||
|
||
service.start(true) | ||
.subscribe((response: ConnectionState) => { | ||
connectionState = response; | ||
}); | ||
|
||
expect(connectionState).toBe(ConnectionState.Connected); | ||
})); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters