Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Rewrite the ‘int’ test into Mocha

  • Loading branch information...
commit 17c2a8a5dbfd5eb35f6203f54dffd1eb567cfa50 1 parent bd76af6
@Baggz authored
Showing with 48 additions and 0 deletions.
  1. +48 −0 tests/json/attributes/format/int.js
View
48 tests/json/attributes/format/int.js
@@ -0,0 +1,48 @@
+if (typeof module !== 'undefined' && module.exports) {
+ var expect = require('expect.js');
+ var Amanda = require('../../../../dist/latest.js');
+}
+
+/**
+ * Format
+ * --------------------
+ */
+suite('JSON/Attribute/format#int', function() {
+
+ var count = 0;
+
+ /**
+ * Schema
+ */
+ var schema = {
+ format: 'int'
+ };
+
+ /**
+ * Validator
+ */
+ var Validator = new Amanda('json');
+
+ test('should not return an error', function() {
+ [
+ 1,
+ 2,
+ 3,
+ 4,
+ 5,
+ 6,
+ -1,
+ -2
+ ].forEach(function(data) {
+ Validator.validate(data, schema, function(error) {
+ count += 1;
+ expect(error).to.not.be.ok();
+ });
+ });
+ });
+
+ test('should run 8 times', function() {
+ expect(count).to.be.eql(8);
+ });
+
+});
Please sign in to comment.
Something went wrong with that request. Please try again.