Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Matrix
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Container Registry
Model registry
Operate
Environments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TeDomum
Matrix
Commits
dd8af556
Commit
dd8af556
authored
10 years ago
by
Kegan Dougal
Browse files
Options
Downloads
Patches
Plain Diff
Start adding regression tests. First up, register-controller for SYWEB-109.
parent
a9209234
Loading
Loading
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
syweb/webclient/login/register-controller.js
+1
-1
1 addition, 1 deletion
syweb/webclient/login/register-controller.js
syweb/webclient/test/unit/register-controller.spec.js
+84
-0
84 additions, 0 deletions
syweb/webclient/test/unit/register-controller.spec.js
with
85 additions
and
1 deletion
syweb/webclient/login/register-controller.js
+
1
−
1
View file @
dd8af556
...
...
@@ -124,7 +124,7 @@ angular.module('RegisterController', ['matrixService'])
$location
.
url
(
"
home
"
);
},
function
(
error
)
{
console
.
trace
(
"
Registration error:
"
+
error
);
console
.
error
(
"
Registration error:
"
+
JSON
.
stringify
(
error
)
)
;
if
(
useCaptcha
)
{
Recaptcha
.
reload
();
}
...
...
This diff is collapsed.
Click to expand it.
syweb/webclient/test/unit/register-controller.spec.js
0 → 100644
+
84
−
0
View file @
dd8af556
describe
(
"
RegisterController
"
,
function
()
{
var
rootScope
,
scope
,
ctrl
,
$q
,
$timeout
;
var
userId
=
"
@foo:bar
"
;
var
displayName
=
"
Foo
"
;
var
avatarUrl
=
"
avatar.url
"
;
window
.
webClientConfig
=
{
useCapatcha
:
false
};
// test vars
var
testRegisterData
,
testFailRegisterData
;
// mock services
var
matrixService
=
{
config
:
function
()
{
return
{
user_id
:
userId
}
},
setConfig
:
function
(){},
register
:
function
(
mxid
,
password
,
threepidCreds
,
useCaptcha
)
{
var
d
=
$q
.
defer
();
if
(
testFailRegisterData
)
{
d
.
reject
({
data
:
testFailRegisterData
});
}
else
{
d
.
resolve
({
data
:
testRegisterData
});
}
return
d
.
promise
;
}
};
var
eventStreamService
=
{};
beforeEach
(
function
()
{
module
(
'
matrixWebClient
'
);
// reset test vars
testRegisterData
=
undefined
;
testFailRegisterData
=
undefined
;
});
beforeEach
(
inject
(
function
(
$rootScope
,
$injector
,
$location
,
$controller
,
_$q_
,
_$timeout_
)
{
$q
=
_$q_
;
$timeout
=
_$timeout_
;
scope
=
$rootScope
.
$new
();
rootScope
=
$rootScope
;
routeParams
=
{
user_matrix_id
:
userId
};
ctrl
=
$controller
(
'
RegisterController
'
,
{
'
$scope
'
:
scope
,
'
$rootScope
'
:
$rootScope
,
'
$location
'
:
$location
,
'
matrixService
'
:
matrixService
,
'
eventStreamService
'
:
eventStreamService
});
})
);
// SYWEB-109
it
(
'
should display an error if the HS rejects the username on registration
'
,
function
()
{
var
prevFeedback
=
angular
.
copy
(
scope
.
feedback
);
testFailRegisterData
=
{
errcode
:
"
M_UNKNOWN
"
,
error
:
"
I am rejecting you.
"
};
scope
.
account
.
pwd1
=
"
password
"
;
scope
.
account
.
pwd2
=
"
password
"
;
scope
.
account
.
desired_user_id
=
"
bob
"
;
scope
.
register
();
rootScope
.
$digest
();
expect
(
scope
.
feedback
).
toNotEqual
(
prevFeedback
);
});
});
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment