Merge pull request #136 from overleaf/jpa-backport-sinon-v2

[misc] backport sinon v2
This commit is contained in:
Jakob Ackermann 2020-05-18 11:18:06 +02:00 committed by GitHub
commit 4e400dc7da
5 changed files with 91 additions and 198 deletions

View file

@ -666,15 +666,6 @@
"type-detect": "0.1.1" "type-detect": "0.1.1"
} }
}, },
"define-properties": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz",
"integrity": "sha1-z4jabL7ib+bbcJT2HYcMvYTO6fE=",
"dev": true,
"requires": {
"object-keys": "^1.0.12"
}
},
"delay": { "delay": {
"version": "4.3.0", "version": "4.3.0",
"resolved": "https://registry.npmjs.org/delay/-/delay-4.3.0.tgz", "resolved": "https://registry.npmjs.org/delay/-/delay-4.3.0.tgz",
@ -700,6 +691,12 @@
"resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz", "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz",
"integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=" "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA="
}, },
"diff": {
"version": "3.5.0",
"resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz",
"integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==",
"dev": true
},
"dtrace-provider": { "dtrace-provider": {
"version": "0.2.8", "version": "0.2.8",
"resolved": "https://registry.npmjs.org/dtrace-provider/-/dtrace-provider-0.2.8.tgz", "resolved": "https://registry.npmjs.org/dtrace-provider/-/dtrace-provider-0.2.8.tgz",
@ -766,31 +763,6 @@
"resolved": "https://registry.npmjs.org/ent/-/ent-2.2.0.tgz", "resolved": "https://registry.npmjs.org/ent/-/ent-2.2.0.tgz",
"integrity": "sha1-6WQhkyWiHQX0RGai9obtbOX13R0=" "integrity": "sha1-6WQhkyWiHQX0RGai9obtbOX13R0="
}, },
"es-abstract": {
"version": "1.13.0",
"resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.13.0.tgz",
"integrity": "sha1-rIYUX91QmdjdSVWMy6Lq+biOJOk=",
"dev": true,
"requires": {
"es-to-primitive": "^1.2.0",
"function-bind": "^1.1.1",
"has": "^1.0.3",
"is-callable": "^1.1.4",
"is-regex": "^1.0.4",
"object-keys": "^1.0.12"
}
},
"es-to-primitive": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.0.tgz",
"integrity": "sha1-7fckeAM0VujdqO8J4ArZZQcH83c=",
"dev": true,
"requires": {
"is-callable": "^1.1.4",
"is-date-object": "^1.0.1",
"is-symbol": "^1.0.2"
}
},
"es6-promise": { "es6-promise": {
"version": "4.2.8", "version": "4.2.8",
"resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz", "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz",
@ -1046,12 +1018,12 @@
} }
}, },
"formatio": { "formatio": {
"version": "1.1.1", "version": "1.2.0",
"resolved": "https://registry.npmjs.org/formatio/-/formatio-1.1.1.tgz", "resolved": "https://registry.npmjs.org/formatio/-/formatio-1.2.0.tgz",
"integrity": "sha1-XtPM1jZVEJc4NGXZlhmRAOhhYek=", "integrity": "sha1-87IWfZBoxGmKjVH092CjmlTYGOs=",
"dev": true, "dev": true,
"requires": { "requires": {
"samsam": "~1.1" "samsam": "1.x"
} }
}, },
"forwarded": { "forwarded": {
@ -1070,12 +1042,6 @@
"integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=",
"dev": true "dev": true
}, },
"function-bind": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz",
"integrity": "sha1-pWiZ0+o8m6uHS7l3O3xe3pL0iV0=",
"dev": true
},
"gaxios": { "gaxios": {
"version": "1.8.4", "version": "1.8.4",
"resolved": "https://registry.npmjs.org/gaxios/-/gaxios-1.8.4.tgz", "resolved": "https://registry.npmjs.org/gaxios/-/gaxios-1.8.4.tgz",
@ -1189,21 +1155,6 @@
"har-schema": "^2.0.0" "har-schema": "^2.0.0"
} }
}, },
"has": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz",
"integrity": "sha1-ci18v8H2qoJB8W3YFOAR4fQeh5Y=",
"dev": true,
"requires": {
"function-bind": "^1.1.1"
}
},
"has-symbols": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.0.tgz",
"integrity": "sha1-uhqPGvKg/DllD1yFA2dwQSIGO0Q=",
"dev": true
},
"he": { "he": {
"version": "1.1.1", "version": "1.1.1",
"resolved": "https://registry.npmjs.org/he/-/he-1.1.1.tgz", "resolved": "https://registry.npmjs.org/he/-/he-1.1.1.tgz",
@ -1323,53 +1274,11 @@
"resolved": "https://registry.npmjs.org/is/-/is-3.3.0.tgz", "resolved": "https://registry.npmjs.org/is/-/is-3.3.0.tgz",
"integrity": "sha512-nW24QBoPcFGGHJGUwnfpI7Yc5CdqWNdsyHQszVE/z2pKHXzh7FZ5GWhJqSyaQ9wMkQnsTx+kAI8bHlCX4tKdbg==" "integrity": "sha512-nW24QBoPcFGGHJGUwnfpI7Yc5CdqWNdsyHQszVE/z2pKHXzh7FZ5GWhJqSyaQ9wMkQnsTx+kAI8bHlCX4tKdbg=="
}, },
"is-arguments": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/is-arguments/-/is-arguments-1.0.4.tgz",
"integrity": "sha1-P6+WbHy6D/Q3+zH2JQCC/PBEjPM=",
"dev": true
},
"is-buffer": { "is-buffer": {
"version": "2.0.4", "version": "2.0.4",
"resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.4.tgz", "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.4.tgz",
"integrity": "sha512-Kq1rokWXOPXWuaMAqZiJW4XxsmD9zGx9q4aePabbn3qCRGedtH7Cm+zV8WETitMfu1wdh+Rvd6w5egwSngUX2A==" "integrity": "sha512-Kq1rokWXOPXWuaMAqZiJW4XxsmD9zGx9q4aePabbn3qCRGedtH7Cm+zV8WETitMfu1wdh+Rvd6w5egwSngUX2A=="
}, },
"is-callable": {
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.4.tgz",
"integrity": "sha1-HhrfIZ4e62hNaR+dagX/DTCiTXU=",
"dev": true
},
"is-date-object": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.1.tgz",
"integrity": "sha1-mqIOtq7rv/d/vTPnTKAbM1gdOhY=",
"dev": true
},
"is-generator-function": {
"version": "1.0.7",
"resolved": "https://registry.npmjs.org/is-generator-function/-/is-generator-function-1.0.7.tgz",
"integrity": "sha1-0hMuUpuwAAp/gHlNS99c1eWBNSI=",
"dev": true
},
"is-regex": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.0.4.tgz",
"integrity": "sha1-VRdIm1RwkbCTDglWVM7SXul+lJE=",
"dev": true,
"requires": {
"has": "^1.0.1"
}
},
"is-symbol": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.2.tgz",
"integrity": "sha1-oFX2rlcZLK7jKeeoYBGLSXqVDzg=",
"dev": true,
"requires": {
"has-symbols": "^1.0.0"
}
},
"is-typedarray": { "is-typedarray": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz",
@ -1503,9 +1412,9 @@
} }
}, },
"lolex": { "lolex": {
"version": "1.3.2", "version": "1.6.0",
"resolved": "https://registry.npmjs.org/lolex/-/lolex-1.3.2.tgz", "resolved": "https://registry.npmjs.org/lolex/-/lolex-1.6.0.tgz",
"integrity": "sha1-fD2mL/yzDw9agKJWbKJORdigHzE=", "integrity": "sha1-OpoCg0UqR9dDnnJzG54H1zhuSfY=",
"dev": true "dev": true
}, },
"long": { "long": {
@ -1730,6 +1639,12 @@
"integrity": "sha1-OSHhECMtHreQ89rGG7NwUxx9NW4=", "integrity": "sha1-OSHhECMtHreQ89rGG7NwUxx9NW4=",
"dev": true "dev": true
}, },
"native-promise-only": {
"version": "0.8.1",
"resolved": "https://registry.npmjs.org/native-promise-only/-/native-promise-only-0.8.1.tgz",
"integrity": "sha1-IKMYwwy0X3H+et+/eyHJnBRy7xE=",
"dev": true
},
"ncp": { "ncp": {
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/ncp/-/ncp-2.0.0.tgz", "resolved": "https://registry.npmjs.org/ncp/-/ncp-2.0.0.tgz",
@ -1756,24 +1671,6 @@
"resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz",
"integrity": "sha1-R6ewFrqmi1+g7PPe4IqFxnmsZFU=" "integrity": "sha1-R6ewFrqmi1+g7PPe4IqFxnmsZFU="
}, },
"object-keys": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz",
"integrity": "sha1-HEfyct8nfzsdrwYWd9nILiMixg4=",
"dev": true
},
"object.entries": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/object.entries/-/object.entries-1.1.0.tgz",
"integrity": "sha1-ICT8bWuiRq7ji9sP/Vz7zzcbdRk=",
"dev": true,
"requires": {
"define-properties": "^1.1.3",
"es-abstract": "^1.12.0",
"function-bind": "^1.1.1",
"has": "^1.0.3"
}
},
"on-finished": { "on-finished": {
"version": "2.3.0", "version": "2.3.0",
"resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz",
@ -2202,9 +2099,9 @@
"integrity": "sha1-RPoWGwGHuVSd2Eu5GAL5vYOFzWo=" "integrity": "sha1-RPoWGwGHuVSd2Eu5GAL5vYOFzWo="
}, },
"samsam": { "samsam": {
"version": "1.1.2", "version": "1.3.0",
"resolved": "https://registry.npmjs.org/samsam/-/samsam-1.1.2.tgz", "resolved": "https://registry.npmjs.org/samsam/-/samsam-1.3.0.tgz",
"integrity": "sha1-vsEf3IOp/aBjQBIQ5AF2wwJNFWc=", "integrity": "sha512-1HwIYD/8UlOtFS3QO3w7ey+SdSDFE4HRNLZoZRYVQefrOY3l17epswImeB1ijgJFQJodIaHcwkp3r/myBjFVbg==",
"dev": true "dev": true
}, },
"sandboxed-module": { "sandboxed-module": {
@ -2299,15 +2196,42 @@
"integrity": "sha512-sQTKC1Re/rM6XyFM6fIAGHRPVGvyXfgzIDvzoq608vM+jeyVD0Tu1E6Np0Kc2zAIFWIj963V2800iF/9LPieQw==" "integrity": "sha512-sQTKC1Re/rM6XyFM6fIAGHRPVGvyXfgzIDvzoq608vM+jeyVD0Tu1E6Np0Kc2zAIFWIj963V2800iF/9LPieQw=="
}, },
"sinon": { "sinon": {
"version": "1.17.7", "version": "2.4.1",
"resolved": "https://registry.npmjs.org/sinon/-/sinon-1.17.7.tgz", "resolved": "https://registry.npmjs.org/sinon/-/sinon-2.4.1.tgz",
"integrity": "sha1-RUKk9JugxFwF6y6d2dID4rjv4L8=", "integrity": "sha512-vFTrO9Wt0ECffDYIPSP/E5bBugt0UjcBQOfQUMh66xzkyPEnhl/vM2LRZi2ajuTdkH07sA6DzrM6KvdvGIH8xw==",
"dev": true, "dev": true,
"requires": { "requires": {
"formatio": "1.1.1", "diff": "^3.1.0",
"lolex": "1.3.2", "formatio": "1.2.0",
"samsam": "1.1.2", "lolex": "^1.6.0",
"util": ">=0.10.3 <1" "native-promise-only": "^0.8.1",
"path-to-regexp": "^1.7.0",
"samsam": "^1.1.3",
"text-encoding": "0.6.4",
"type-detect": "^4.0.0"
},
"dependencies": {
"isarray": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz",
"integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=",
"dev": true
},
"path-to-regexp": {
"version": "1.8.0",
"resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-1.8.0.tgz",
"integrity": "sha512-n43JRhlUKUAlibEJhPeir1ncUID16QnEjNpwzNdO3Lm4ywrBpBZ5oLD0I6br9evr1Y9JTqwRtAh7JLoOzAQdVA==",
"dev": true,
"requires": {
"isarray": "0.0.1"
}
},
"type-detect": {
"version": "4.0.8",
"resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz",
"integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==",
"dev": true
}
} }
}, },
"socket.io": { "socket.io": {
@ -2453,6 +2377,12 @@
} }
} }
}, },
"text-encoding": {
"version": "0.6.4",
"resolved": "https://registry.npmjs.org/text-encoding/-/text-encoding-0.6.4.tgz",
"integrity": "sha1-45mpgiV6J22uQou5KEXLcb3CbRk=",
"dev": true
},
"through": { "through": {
"version": "2.3.8", "version": "2.3.8",
"resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz",
@ -2554,27 +2484,6 @@
} }
} }
}, },
"util": {
"version": "0.12.1",
"resolved": "https://registry.npmjs.org/util/-/util-0.12.1.tgz",
"integrity": "sha1-+QjntjPnOWx2TmlN0U5xYlbOit4=",
"dev": true,
"requires": {
"inherits": "^2.0.3",
"is-arguments": "^1.0.4",
"is-generator-function": "^1.0.7",
"object.entries": "^1.1.0",
"safe-buffer": "^5.1.2"
},
"dependencies": {
"safe-buffer": {
"version": "5.2.0",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.0.tgz",
"integrity": "sha1-t02uxJsRSPiMZLaNSbHoFcHy9Rk=",
"dev": true
}
}
},
"util-deprecate": { "util-deprecate": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",

View file

@ -42,7 +42,7 @@
"chai": "~1.9.1", "chai": "~1.9.1",
"cookie-signature": "^1.0.5", "cookie-signature": "^1.0.5",
"sandboxed-module": "~0.3.0", "sandboxed-module": "~0.3.0",
"sinon": "^1.5.2", "sinon": "^2.4.1",
"mocha": "^4.0.1", "mocha": "^4.0.1",
"uid-safe": "^1.0.1", "uid-safe": "^1.0.1",
"timekeeper": "0.0.4" "timekeeper": "0.0.4"

View file

@ -84,20 +84,16 @@ describe 'AuthorizationManager', ->
@client.params.privilege_level = "unknown" @client.params.privilege_level = "unknown"
it "should not allow access", () -> it "should not allow access", () ->
@AuthorizationManager.assertClientCanViewProjectAndDoc @client, @doc_id, @callback @AuthorizationManager.assertClientCanViewProjectAndDoc @client, @doc_id, (err) ->
@callback err.message.should.equal "not authorized"
.calledWith(new Error("not authorised"))
.should.equal true
describe "even when authorised at the doc level", -> describe "even when authorised at the doc level", ->
beforeEach (done) -> beforeEach (done) ->
@AuthorizationManager.addAccessToDoc @client, @doc_id, done @AuthorizationManager.addAccessToDoc @client, @doc_id, done
it "should not allow access", () -> it "should not allow access", () ->
@AuthorizationManager.assertClientCanViewProjectAndDoc @client, @doc_id, @callback @AuthorizationManager.assertClientCanViewProjectAndDoc @client, @doc_id, (err) ->
@callback err.message.should.equal "not authorized"
.calledWith(new Error("not authorised"))
.should.equal true
describe "when authorised at the project level", -> describe "when authorised at the project level", ->
beforeEach () -> beforeEach () ->
@ -105,10 +101,8 @@ describe 'AuthorizationManager', ->
describe "and not authorised at the document level", -> describe "and not authorised at the document level", ->
it "should not allow access", () -> it "should not allow access", () ->
@AuthorizationManager.assertClientCanViewProjectAndDoc @client, @doc_id, @callback @AuthorizationManager.assertClientCanViewProjectAndDoc @client, @doc_id, (err) ->
@callback err.message.should.equal "not authorized"
.calledWith(new Error("not authorised"))
.should.equal true
describe "and authorised at the document level", -> describe "and authorised at the document level", ->
beforeEach (done) -> beforeEach (done) ->
@ -126,10 +120,8 @@ describe 'AuthorizationManager', ->
@AuthorizationManager.removeAccessToDoc @client, @doc_id, done @AuthorizationManager.removeAccessToDoc @client, @doc_id, done
it "should deny access", () -> it "should deny access", () ->
@AuthorizationManager.assertClientCanViewProjectAndDoc @client, @doc_id, @callback @AuthorizationManager.assertClientCanViewProjectAndDoc @client, @doc_id, (err) ->
@callback err.message.should.equal "not authorized"
.calledWith(new Error("not authorised"))
.should.equal true
describe "assertClientCanEditProjectAndDoc", -> describe "assertClientCanEditProjectAndDoc", ->
beforeEach () -> beforeEach () ->
@ -142,20 +134,16 @@ describe 'AuthorizationManager', ->
@client.params.privilege_level = "readOnly" @client.params.privilege_level = "readOnly"
it "should not allow access", () -> it "should not allow access", () ->
@AuthorizationManager.assertClientCanEditProjectAndDoc @client, @doc_id, @callback @AuthorizationManager.assertClientCanEditProjectAndDoc @client, @doc_id, (err) ->
@callback err.message.should.equal "not authorized"
.calledWith(new Error("not authorised"))
.should.equal true
describe "even when authorised at the doc level", -> describe "even when authorised at the doc level", ->
beforeEach (done) -> beforeEach (done) ->
@AuthorizationManager.addAccessToDoc @client, @doc_id, done @AuthorizationManager.addAccessToDoc @client, @doc_id, done
it "should not allow access", () -> it "should not allow access", () ->
@AuthorizationManager.assertClientCanEditProjectAndDoc @client, @doc_id, @callback @AuthorizationManager.assertClientCanEditProjectAndDoc @client, @doc_id, (err) ->
@callback err.message.should.equal "not authorized"
.calledWith(new Error("not authorised"))
.should.equal true
describe "when authorised at the project level", -> describe "when authorised at the project level", ->
beforeEach () -> beforeEach () ->
@ -163,10 +151,8 @@ describe 'AuthorizationManager', ->
describe "and not authorised at the document level", -> describe "and not authorised at the document level", ->
it "should not allow access", () -> it "should not allow access", () ->
@AuthorizationManager.assertClientCanEditProjectAndDoc @client, @doc_id, @callback @AuthorizationManager.assertClientCanEditProjectAndDoc @client, @doc_id, (err) ->
@callback err.message.should.equal "not authorized"
.calledWith(new Error("not authorised"))
.should.equal true
describe "and authorised at the document level", -> describe "and authorised at the document level", ->
beforeEach (done) -> beforeEach (done) ->
@ -184,7 +170,5 @@ describe 'AuthorizationManager', ->
@AuthorizationManager.removeAccessToDoc @client, @doc_id, done @AuthorizationManager.removeAccessToDoc @client, @doc_id, done
it "should deny access", () -> it "should deny access", () ->
@AuthorizationManager.assertClientCanEditProjectAndDoc @client, @doc_id, @callback @AuthorizationManager.assertClientCanEditProjectAndDoc @client, @doc_id, (err) ->
@callback err.message.should.equal "not authorized"
.calledWith(new Error("not authorised"))
.should.equal true

View file

@ -60,7 +60,7 @@ describe 'WebApiManager', ->
it "should call the callback with an error", -> it "should call the callback with an error", ->
@callback @callback
.calledWith(new Error("non-success code from web: 500")) .calledWith(sinon.match({message: "non-success status code from web: 500"}))
.should.equal true .should.equal true
describe "with no data from web", -> describe "with no data from web", ->
@ -70,7 +70,7 @@ describe 'WebApiManager', ->
it "should call the callback with an error", -> it "should call the callback with an error", ->
@callback @callback
.calledWith(new Error("no data returned from joinProject request")) .calledWith(sinon.match({message: "no data returned from joinProject request"}))
.should.equal true .should.equal true
describe "when the project is over its rate limit", -> describe "when the project is over its rate limit", ->
@ -80,5 +80,5 @@ describe 'WebApiManager', ->
it "should call the callback with a TooManyRequests error code", -> it "should call the callback with a TooManyRequests error code", ->
@callback @callback
.calledWith(new CodedError("rate-limit hit when joining project", "TooManyRequests")) .calledWith(sinon.match({message: "rate-limit hit when joining project", code: "TooManyRequests"}))
.should.equal true .should.equal true

View file

@ -119,7 +119,7 @@ describe 'WebsocketController', ->
it "should return an error", -> it "should return an error", ->
@callback @callback
.calledWith(new Error("not authorized")) .calledWith(sinon.match({message: "not authorized"}))
.should.equal true .should.equal true
it "should not log an error", -> it "should not log an error", ->
@ -143,7 +143,7 @@ describe 'WebsocketController', ->
it "should return an error", -> it "should return an error", ->
@callback @callback
.calledWith(new Error("subscribe failed")) .calledWith(sinon.match({message: "subscribe failed"}))
.should.equal true .should.equal true
@callback.args[0][0].message.should.equal "subscribe failed" @callback.args[0][0].message.should.equal "subscribe failed"
@ -369,7 +369,7 @@ describe 'WebsocketController', ->
@WebsocketController.joinDoc @client, @doc_id, -1, @options, @callback @WebsocketController.joinDoc @client, @doc_id, -1, @options, @callback
it "should call the callback with an error", -> it "should call the callback with an error", ->
@callback.calledWith(@err).should.equal true @callback.calledWith(sinon.match({message: "not authorized"})).should.equal true
it "should not call the DocumentUpdaterManager", -> it "should not call the DocumentUpdaterManager", ->
@DocumentUpdaterManager.getDocument.called.should.equal false @DocumentUpdaterManager.getDocument.called.should.equal false