summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/srp/spec/signup_spec.js
diff options
context:
space:
mode:
authorAzul <azul@riseup.net>2017-03-23 14:12:30 +0100
committerAzul <azul@riseup.net>2017-03-23 14:12:30 +0100
commit372b15afed0b7477bd83062feaa7f24c4d40e38d (patch)
tree0e901532c839d7d0db922cb97d064df279090116 /app/assets/javascripts/srp/spec/signup_spec.js
parentac4cf4a1da4dcc697f1f5219f0073c5991a135e0 (diff)
git subrepo clone https://leap.se/git/srp_js app/assets/javascripts/srp
subrepo: subdir: "app/assets/javascripts/srp" merged: "9e1a417" upstream: origin: "https://leap.se/git/srp_js" branch: "master" commit: "9e1a417" git-subrepo: version: "0.3.1" origin: "https://github.com/ingydotnet/git-subrepo" commit: "a7ee886"
Diffstat (limited to 'app/assets/javascripts/srp/spec/signup_spec.js')
m---------app/assets/javascripts/srp0
-rw-r--r--app/assets/javascripts/srp/spec/signup_spec.js31
2 files changed, 31 insertions, 0 deletions
diff --git a/app/assets/javascripts/srp b/app/assets/javascripts/srp
deleted file mode 160000
-Subproject 9e1a41733468d4a3f5102b04277b9cd7b52d0a4
diff --git a/app/assets/javascripts/srp/spec/signup_spec.js b/app/assets/javascripts/srp/spec/signup_spec.js
new file mode 100644
index 0000000..89b0936
--- /dev/null
+++ b/app/assets/javascripts/srp/spec/signup_spec.js
@@ -0,0 +1,31 @@
+describe("Loading SRP", function() {
+ it("provides a signup function", function() {
+ expect(typeof srp.signup).toBe('function');
+ });
+
+});
+
+describe("Signup with srp var", function() {
+
+ beforeEach(function() {
+ specHelper.setupFakeXHR.apply(this);
+ calculate = new srp.Calculate();
+ calculate.randomSalt = function() {return "4c78c3f8"};
+ srp.session = new srp.Session(undefined, calculate);
+ });
+
+ afterEach(function() {
+ this.xhr.restore();
+ });
+
+ it("identifies after successful registration (INTEGRATION)", function(){
+ var callback = jasmine.createSpy();
+ srp.signedUp = callback;
+ srp.signup();
+ this.expectRequest('/1/users.json', "user[login]=testuser&user[password_salt]=4c78c3f8&user[password_verifier]=474c26aa42d11f20544a00f7bf9711c4b5cf7aab95ed448df82b95521b96668e7480b16efce81c861870302560ddf6604c67df54f1d04b99d5bb9d0f02c6051ada5dc9d594f0d4314e12f876cfca3dcd99fc9c98c2e6a5e04298b11061fb8549a22cde0564e91514080df79bca1c38c682214d65d590f66b3719f954b078b83c", 'POST')
+ this.respondJSON({password_salt: "4c78c3f8", login: "testuser", ok: "true"});
+ expect(callback).toHaveBeenCalled();
+ });
+
+});
+