Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

Commit

Permalink
chore(log): add log.empty() method to the testing logger
Browse files Browse the repository at this point in the history
`log.empty()` is the same as `log.reset()`, except thati `empty()`  also returns the current array with messages

instead of:

```
// do work
expect(log).toEqual(['bar']);
log.reset();
```

do:

```
// do work
expect(log.empty()).toEqual(['bar']);
```
  • Loading branch information
IgorMinar committed Mar 18, 2014
1 parent 748a6c8 commit c5e41a0
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions test/helpers/testabilityPatch.js
Original file line number Diff line number Diff line change
Expand Up @@ -269,21 +269,27 @@ function provideLog($provide) {

log.toString = function() {
return messages.join('; ');
}
};

log.toArray = function() {
return messages;
}
};

log.reset = function() {
messages = [];
};

log.empty = function() {
var currentMessages = messages;
messages = [];
return currentMessages;
}

log.fn = function(msg) {
return function() {
log(msg);
}
}
};
};

log.$$log = true;

Expand Down

0 comments on commit c5e41a0

Please sign in to comment.