-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
model validation implemented, need more testing
- Loading branch information
1 parent
9d7f661
commit 7816037
Showing
6 changed files
with
79 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -101,11 +101,40 @@ exports.test_simpleUserModel = function(test) { | |
|
||
test.ok(user.name == "name", "User name should be valid"); | ||
test.ok(user.email == "[email protected]", "User email should be valid"); | ||
test.ok(user.password == "abcd1234", "User password should be valid"); | ||
test.ok(user.password, "User password should be valid"); | ||
test.ok(user.access_token == "01234567890", "User access_token should be valid"); | ||
|
||
test.ok(user._id, "Model _id hash should be valid"); | ||
test.ok(user.toJSON, "Model 'toJSON' should be valid"); | ||
|
||
test.done(); | ||
} | ||
|
||
exports.test_simpleCreditCardValidation = function(test) { | ||
|
||
test.expect(2); | ||
|
||
var user = false; | ||
|
||
try { | ||
|
||
user = model.create("user", { | ||
|
||
name: "name", | ||
email: "[email protected]", | ||
password: "abcd1234", | ||
credit: "12345", | ||
access_token: "01234567890" | ||
|
||
}); | ||
} | ||
catch(e) { | ||
|
||
test.ok(e.message, "An error message is expected."); | ||
test.ok(!user, "User should not be valid."); | ||
test.done(); | ||
return; | ||
} | ||
|
||
test.fail(); | ||
} |