Skip to content
This repository was archived by the owner on Mar 4, 2025. It is now read-only.

Commit 82973e8

Browse files
author
vikasrohit
committed
SUP-2883, URL should be removed after successful adding as web link.
-- Updated unit tests
1 parent a0079df commit 82973e8

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

app/directives/external-account/external-web-links.directive.spec.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,24 +90,29 @@ describe('ExternalWebLinks Directive', function() {
9090
});
9191
expect(topcoderLink).to.exist;
9292
expect(topcoderLink.status).to.exist.to.equal('PENDING');
93+
expect(element.isolateScope().url).not.to.exist;
9394
expect(toasterSvc.pop).to.have.been.calledWith('success').calledOnce;
9495
});
9596

9697
it('should NOT add new weblink to linkedAccounts', function() {
98+
var urlToAdd = 'https://www.topcoder.com';
9799
element.isolateScope().userHandle = 'throwError';
98-
element.isolateScope().url = 'https://www.topcoder.com';
100+
element.isolateScope().url = urlToAdd;
99101
element.isolateScope().addWebLink();
100102
scope.$digest();
101103
expect(scope.linkedAccounts).to.have.length(1);
104+
expect(element.isolateScope().url).to.exist.to.equal(urlToAdd);
102105
expect(toasterSvc.pop).to.have.been.calledWith('error').calledOnce;
103106
});
104107

105108
it('should NOT add new weblink to linkedAccounts', function() {
109+
var urlToAdd = 'https://www.topcoder.com';
106110
element.isolateScope().userHandle = 'alreadyExistsError';
107-
element.isolateScope().url = 'https://www.topcoder.com';
111+
element.isolateScope().url = urlToAdd;
108112
element.isolateScope().addWebLink();
109113
scope.$digest();
110114
expect(scope.linkedAccounts).to.have.length(1);
115+
expect(element.isolateScope().url).to.exist.to.equal(urlToAdd);
111116
expect(toasterSvc.pop).to.have.been.calledWith('error').calledOnce;
112117
});
113118

0 commit comments

Comments
 (0)