@@ -65,7 +65,7 @@ function MyClass() {
65
65
66
66
A problem surfaces in tests when we would like to instantiate a `MockXHR` that would
67
67
allow us to return fake data and simulate network failures. By calling `new XHR()` we are
68
- permanently bound to the actual XHR and there is no way to replace it. Yes, we could monkey
68
+ permanently bound to the actual XHR and there is no way to replace it. Yes, we could monkey
69
69
patch, but that is a bad idea for many reasons which are outside the scope of this document.
70
70
71
71
Here's an example of how the class above becomes hard to test when resorting to monkey patching:
@@ -96,7 +96,7 @@ function MyClass() {
96
96
```
97
97
98
98
While no new dependency instance is created, it is fundamentally the same as `new` in
99
- that no way exists to intercept the call to `global.xhr` for testing purposes, other than
99
+ that no way exists to intercept the call to `global.xhr` for testing purposes, other than
100
100
through monkey patching. The basic issue for testing is that a global variable needs to be mutated in
101
101
order to replace it with call to a mock method. For further explanation of why this is bad see: [Brittle Global
102
102
State & Singletons](http://misko.hevery.com/code-reviewers-guide/flaw-brittle-global-state-singletons/)
@@ -133,7 +133,7 @@ function MyClass() {
133
133
134
134
However, where does the serviceRegistry come from? If it is:
135
135
* `new`-ed up, the test has no chance to reset the services for testing.
136
- * a global look-up then the service returned is global as well (but resetting is easier, since
136
+ * a global look-up then the service returned is global as well (but resetting is easier, since
137
137
only one global variable exists to be reset).
138
138
139
139
The class above is hard to test since we have to change the global state:
@@ -296,7 +296,7 @@ Now we can add a directive to our app.
296
296
app.directive('aGreatEye', function () {
297
297
return {
298
298
restrict: 'E',
299
- replace: true,
299
+ replace: true,
300
300
template: '<h1>lidless, wreathed in flame, {{1 + 1}} times</h1>'
301
301
};
302
302
});
0 commit comments