Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Rewrite the ‘percentage’ test suite into Mocha

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