Permalink
Browse files

Made README.md use the newer addTest method for registering tests.

This function deals better with edge cases like tests named
'constructor'.
  • Loading branch information...
jacobsa committed Nov 12, 2014
1 parent 2d057a2 commit 9a811dfbe264a349577e31ae5a3bc11a7de672c4
Showing with 4 additions and 4 deletions.
  1. +4 −4 README.markdown
View
@@ -41,23 +41,23 @@ function UserInfoTest() {
}
registerTestSuite(UserInfoTest);
-UserInfoTest.prototype.formatsUSPhoneNumber = function() {
+addTest(UserInfoTest, function formatsUSPhoneNumber() {
// Expect a call to the database function with the argument 0xdeadbeef. When
// the call is received, return the supplied string.
expectCall(this.getInfoFromDb_)(0xdeadbeef)
.willOnce(returnWith('phone_number: "650 253 0000"'));
// Make sure that our class returns correctly formatted output.
expectEq('(650) 253-0000', this.userInfo_.getPhoneForId(0xdeadbeef));
-};
+});
-UserInfoTest.prototype.returnsLastNameFirst = function() {
+addTest(UserInfoTest, function returnsLastNameFirst() {
expectCall(this.getInfoFromDb_)(0xdeadbeef)
.willOnce(returnWith('given_name: "John" family_name: "Doe"'));
// Make sure that our class puts the last name first.
expectEq('Doe, John', this.userInfo_.getNameForId(0xdeadbeef));
-};
+});
```
The test's output is clean and readable:

0 comments on commit 9a811df

Please sign in to comment.