forked from strophe/strophejs-plugins
-
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.
run specs with buster instead of the dead project 'jasmine-runner'
- Loading branch information
Showing
5 changed files
with
58 additions
and
51 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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
var config = module.exports; | ||
|
||
config["rpc"] = { | ||
environment: "browser", | ||
specs: ["spec/*.spec.js"], | ||
sources: ["strophe.rpc.js"], | ||
libs: [ | ||
"lib/strophe.js", | ||
"spec/strophe.rpc.spec.helper.js" | ||
] | ||
}; |
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 |
---|---|---|
@@ -1,39 +1,38 @@ | ||
var helper = (function() { | ||
function receive(c,req) { | ||
c._dataRecv(createRequest(req)); | ||
} | ||
function receive(c,req) { | ||
c._dataRecv(createRequest(req)); | ||
} | ||
|
||
function spyon (obj, method, cb) { | ||
spyOn(obj,method).andCallFake(function(res) { | ||
res = res; | ||
cb.call(this,res); | ||
}); | ||
} | ||
function spyon (obj, method, cb) { | ||
sinon.stub(obj,method, function(res) { | ||
cb.call(this,res); | ||
}); | ||
} | ||
|
||
function mockConnection() { | ||
var c = new Strophe.Connection(); | ||
c.authenticated = true; | ||
c.jid = 'n@d/r2'; | ||
c._processRequest = function() {}; | ||
c._changeConnectStatus(Strophe.Status.CONNECTED); | ||
return c; | ||
} | ||
function mockConnection() { | ||
var c = new Strophe.Connection(); | ||
c.authenticated = true; | ||
c.jid = 'n@d/r2'; | ||
c._processRequest = function() {}; | ||
c._changeConnectStatus(Strophe.Status.CONNECTED); | ||
return c; | ||
} | ||
|
||
function createRequest(iq) { | ||
iq = typeof iq.tree == "function" ? iq.tree() : iq; | ||
var req = new Strophe.Request(iq, function() {}); | ||
req.getResponse = function() { | ||
var env = new Strophe.Builder('env', {type: 'mock'}).tree(); | ||
env.appendChild(iq); | ||
return env; | ||
}; | ||
return req; | ||
} | ||
function createRequest(iq) { | ||
iq = typeof iq.tree == "function" ? iq.tree() : iq; | ||
var req = new Strophe.Request(iq, function() {}); | ||
req.getResponse = function() { | ||
var env = new Strophe.Builder('env', {type: 'mock'}).tree(); | ||
env.appendChild(iq); | ||
return env; | ||
}; | ||
return req; | ||
} | ||
|
||
return { | ||
createRequest: createRequest, | ||
mockConnection: mockConnection, | ||
receive: receive, | ||
spyon: spyon | ||
}; | ||
})(); | ||
return { | ||
createRequest: createRequest, | ||
mockConnection: mockConnection, | ||
receive: receive, | ||
spyon: spyon | ||
}; | ||
})(); |
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,5 @@ | ||
buster.spec.expose() | ||
|
||
var mockConnection = helper.mockConnection, | ||
spyon = helper.spyon, receive = helper.receive; | ||
|
||
|
@@ -161,7 +163,7 @@ describe("Strophe Jabber-RPC plugin", function() { | |
var handler; | ||
|
||
beforeEach(function() { | ||
handler = jasmine.createSpy(); | ||
handler = sinon.spy(); | ||
}); | ||
|
||
it("should be possible to add a request handler", function() { | ||
|
@@ -246,7 +248,7 @@ describe("Strophe Jabber-RPC plugin", function() { | |
}); | ||
|
||
it("should NOT send forbidden access to the right nodes", function() { | ||
spyOn(connection, "send"); | ||
spyon(connection, "send"); | ||
var iq = $iq({type: "set", id: "123", from: "[email protected]", to: connection.jid}) | ||
.c("query", {xmlns: Strophe.NS.RPC}); | ||
receive(connection, iq); | ||
|
@@ -257,4 +259,4 @@ describe("Strophe Jabber-RPC plugin", function() { | |
|
||
}); | ||
|
||
}); | ||
}); |