Skip to content
This repository was archived by the owner on Apr 7, 2020. It is now read-only.

Commit 59a7ce5

Browse files
committed
fix(tests): remove brittle and low value tests
Testing the internal relationship between exposed API methods is brittle as we are in effect allowing modification of said API methods, rendering the tests moot. Also, refactoring the exposed API methods become harder when there's an explicit bond between them.
1 parent 997db7c commit 59a7ce5

File tree

1 file changed

+1
-31
lines changed

1 file changed

+1
-31
lines changed

test/uiMentionController.spec.js

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -100,19 +100,13 @@ describe('uiMentionController', () => {
100100
});
101101

102102
it('returns the given value', () => {
103-
expect(mentionParser('foo')).to.eq('foo');
103+
expect(mentionParser('foo bar')).to.eq('@[foo bar:1]');
104104
});
105105

106106
it('filters out non matching mentions', () => {
107107
mentionParser('foo bar');
108108
expect(ctrlInstance.mentions).to.eql(mentions.slice(0,1));
109109
});
110-
111-
it('calls the controller render method with the given value', () => {
112-
let spy = sinon.spy(ctrlInstance, 'render');
113-
mentionParser('foo bar');
114-
expect(spy).to.have.been.calledOnce.and.calledWith('@[foo bar:1]');
115-
});
116110
});
117111

118112
context('ngModel.$formatters', () => {
@@ -161,12 +155,6 @@ describe('uiMentionController', () => {
161155
ngModel.$render();
162156
expect($element.val()).to.eq('');
163157
});
164-
165-
it('calls the controller render method', () => {
166-
let spy = sinon.spy(ctrlInstance, 'render');
167-
ngModel.$render();
168-
expect(spy).to.have.been.calledOnce;
169-
});
170158
});
171159
});
172160

@@ -221,12 +209,6 @@ describe('uiMentionController', () => {
221209
it('returns an HTML formatted version of the given argument', () => {
222210
expect(ctrlInstance.highlight(choice)).to.eq('<span>x y</span>');
223211
});
224-
225-
it('calls the controller label method internally', () => {
226-
let spy = sinon.spy(ctrlInstance, 'label');
227-
ctrlInstance.highlight(choice);
228-
expect(spy).to.have.been.calledOnce.and.calledWith(choice);
229-
});
230212
});
231213

232214
context.skip('.decode()', () => {
@@ -266,18 +248,6 @@ describe('uiMentionController', () => {
266248
expect(ctrlInstance.mentions[0]).to.eql({ first: 'foo', last: 'bar' });
267249
});
268250

269-
it('calls the controller cancel method internally', () => {
270-
let spy = sinon.spy(ctrlInstance, 'cancel');
271-
ctrlInstance.select({ first: 'foo', last: 'bar' });
272-
expect(spy).to.have.been.calledOnce;
273-
});
274-
275-
it('calls the ngModel.$render method internally', () => {
276-
let spy = sinon.spy(ngModel, '$render');
277-
ctrlInstance.select({ first: 'foo', last: 'bar' });
278-
expect(spy).to.have.been.calledOnce;
279-
});
280-
281251
it('returns nothing', () => {
282252
expect(ctrlInstance.select({ first: 'foo', last: 'bar' })).to.eq(undefined);
283253
});

0 commit comments

Comments
 (0)