Skip to content
Browse files

Rewrite the ‘email’ test into Mocha

  • Loading branch information...
1 parent 0b565d3 commit 0943172beb74f72b940141eecc08a42122cf29fe @Baggz committed Mar 7, 2012
Showing with 47 additions and 0 deletions.
  1. +47 −0 tests/json/attributes/format/email.js
View
47 tests/json/attributes/format/email.js
@@ -0,0 +1,47 @@
+if (typeof module !== 'undefined' && module.exports) {
+ var expect = require('expect.js');
+ var Amanda = require('../../../../dist/latest.js');
+ var domains = require('../../../resources/domains.js');
+ var emails = require('../../../resources/emails.js');
+}
+
+/**
+ * Format
+ * --------------------
+ */
+suite('JSON/Attribute/format#email', function() {
+
+ var count = 0;
+
+ /**
+ * Schema
+ */
+ var schema = {
+ format: 'email'
+ };
+
+ /**
+ * Validator
+ */
+ var Validator = new Amanda('json');
+
+ test('should not return an error', function() {
+
+ domains.forEach(function(domain) {
+ emails.forEach(function(name) {
+
+ Validator.validate(name + '@' + 'example' + domain, schema, function(error) {
+ count += 1;
+ expect(error).to.not.be.ok();
+ });
+
+ });
+ });
+
+ });
+
+ test('should run 1890 times', function() {
+ expect(count).to.be.eql(1890);
+ });
+
+});

0 comments on commit 0943172

Please sign in to comment.
Something went wrong with that request. Please try again.