This repository has been archived by the owner on Dec 18, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 447
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding infrastructure to write node (a.k.a. unit) tests for ts client (…
- Loading branch information
Showing
14 changed files
with
656 additions
and
11 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
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,3 +1,3 @@ | ||
declare type DataReceived = (data: any) => void; | ||
declare type ErrorHandler = (e: any) => void; | ||
declare type ConnectionClosed = (e?: any) => void; | ||
export declare type DataReceived = (data: any) => void; | ||
export declare type ErrorHandler = (e: any) => void; | ||
export declare type ConnectionClosed = (e?: any) => void; |
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
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
30 changes: 30 additions & 0 deletions
30
test/Microsoft.AspNetCore.Client.SignalR.TS.Tests/Connection.spec.ts
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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import {IHttpClient} from "../../src/Microsoft.AspNetCore.SignalR.Client.TS/HttpClient" | ||
import { Connection } from "../../src/Microsoft.AspNetCore.SignalR.Client.TS/Connection" | ||
import { ISignalROptions } from "../../src/Microsoft.AspNetCore.SignalR.Client.TS/ISignalROptions" | ||
|
||
describe("Connection", () => { | ||
it("starting connection fails if getting id fails", async (done) => { | ||
let options: ISignalROptions = { | ||
httpClient: <IHttpClient>{ | ||
get(url: string): Promise<string> { | ||
if (url.indexOf("/getid") >= 0) { | ||
return Promise.reject("error"); | ||
} | ||
return Promise.resolve(""); | ||
} | ||
} | ||
} as ISignalROptions; | ||
|
||
let connection = new Connection("http://tempuri.org", undefined, options); | ||
|
||
try { | ||
await connection.start(); | ||
fail(); | ||
done(); | ||
} | ||
catch (e) { | ||
expect(e).toBe("error"); | ||
done(); | ||
} | ||
}); | ||
}); |
6 changes: 6 additions & 0 deletions
6
test/Microsoft.AspNetCore.Client.SignalR.TS.Tests/jasmine.json
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"spec_dir": "artifacts/test/Microsoft.AspNetCore.Client.SignalR.TS.Tests", | ||
"spec_files": [ | ||
"./**/*[sS]pec.js" | ||
] | ||
} |
18 changes: 18 additions & 0 deletions
18
test/Microsoft.AspNetCore.Client.SignalR.TS.Tests/tsconfig.json
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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"compileOnSave": true, | ||
"compilerOptions": { | ||
"module": "umd", | ||
"target": "es6", | ||
"sourceMap": true, | ||
"emitDecoratorMetadata": true, | ||
"experimentalDecorators": true, | ||
"removeComments": false, | ||
"noImplicitAny": true, | ||
"suppressImplicitAnyIndexErrors": true, | ||
"outDir": "../../artifacts/test/Microsoft.AspNetCore.Client.SignalR.TS.Tests/" | ||
}, | ||
"include": [ | ||
"./**/*", | ||
"../../typings/*" | ||
] | ||
} |
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
Oops, something went wrong.