-
Notifications
You must be signed in to change notification settings - Fork 107
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
7 changed files
with
35 additions
and
10 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,5 @@ | ||
export const encode = require('notepack.io/browser/encode'); | ||
export const decode = require('notepack.io/browser/decode'); | ||
import * as msgpackDecode from 'notepack.io/browser/decode'; | ||
import * as msgpackEncode from 'notepack.io/browser/encode'; | ||
|
||
export const decode = msgpackDecode; | ||
export const encode = msgpackEncode; |
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,14 @@ | ||
import './util'; | ||
import { assert } from "chai"; | ||
import { Client } from "../src"; | ||
|
||
describe("Client", function () { | ||
|
||
it("join", function () { | ||
const client = new Client("ws://localhost:2546"); | ||
const room = client.join("chat"); | ||
assert.equal(room.name, "chat") | ||
assert.deepEqual(room.state, {}) | ||
}); | ||
|
||
}); |
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,4 +1,7 @@ | ||
import * as localStorage from "node-localstorage"; | ||
import { LocalStorage } from "node-localstorage"; | ||
|
||
(<any>global).WebSocket = {}; | ||
(<any>global).window = { localStorage: localStorage }; | ||
// mock WebSocket | ||
(<any>global).WebSocket = class WebSocket { send() {} }; | ||
|
||
// mock localStorage | ||
(<any>global).window = { localStorage: new LocalStorage('./tests') }; |