chore(log): add log.empty() method to the testing logger
`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']); ```
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user