-
Notifications
You must be signed in to change notification settings - Fork 0
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
Showing
6 changed files
with
46 additions
and
69 deletions.
There are no files selected for viewing
File renamed without changes.
This file was deleted.
Oops, something went wrong.
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,39 @@ | ||
/// <reference path="../SupercondActorTypes.d.ts" /> | ||
|
||
// When running in the Service Fabric Business Platform | ||
// the global _SupercondActor instance will be provided by the environment. | ||
// For testing we need a mock. | ||
import { _SupercondActorMock } from "./support/SupercondActorMock"; | ||
(global as any)._SupercondActor = new _SupercondActorMock(); | ||
|
||
// entry points class definition from the index.ts file | ||
import { MyEntryPointsDefinition } from "../src/index"; | ||
|
||
// Here is our source code for entry points | ||
require('../src/index.ts'); | ||
|
||
// Instead of testing source code we can test the final bundle | ||
// to make sure we have everything we need in it | ||
// (comment the require statement above and uncomment below, | ||
// run 'npm run build' then 'npm test'): | ||
// require('../dist/Scripts/bundle.js') | ||
|
||
describe("_SupercondActor object", () => { | ||
it("should save and increment counter", async () => { | ||
let entry: MyEntryPointsDefinition = (global as any).MyEntryPoints; | ||
|
||
let nbr = 7; | ||
let res = await entry.setCounter(nbr); | ||
expect(res).toBe(nbr); | ||
|
||
res = await entry.incrementCounter(); | ||
expect(res).toBe(8); | ||
|
||
res = await entry.incrementCounter(); | ||
expect(res).toBe(9); | ||
|
||
let keys = await entry.listStateKeys(); | ||
expect(keys.length).toBe(1); | ||
expect(keys[0]).toBe('counter'); | ||
}); | ||
}); |
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 @@ | ||
// calling one of my global entry points defined in the index.ts file | ||
let counter = await MyEntryPoints.IncrementCounter(); | ||
let counter = await MyEntryPoints.incrementCounter(); | ||
console.log('Message from my service: counter=', counter); |
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