From 2127c9e207997531afae2c6c5d01048795d40971 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luiz=20Am=C3=A9rico?= Date: Sat, 21 Apr 2018 19:51:53 -0300 Subject: [PATCH] Add more tests for min validators. Part of #341 --- test/validators/min.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/test/validators/min.js b/test/validators/min.js index 8be813ce..0d63380e 100644 --- a/test/validators/min.js +++ b/test/validators/min.js @@ -107,6 +107,30 @@ module.exports = { age: null }, { validate: true })); } + }, + + "when min:0, 0 < val < 1": { + setUp: function() { + this.model.validation.aFloat = { + min: 0 + }; + }, + "val is string, no leading zero, e.g. '.2'": function() { + assert(this.model.set({ + aFloat: '.2' + }, {validate: true})); + }, + "val is string, leading zero, e.g. '0.2'": function() { + assert(this.model.set({ + aFloat: '0.2' + }, {validate: true})); + }, + "val is number, leading zero, e.g. 0.2": function() { + assert(this.model.set({ + aFloat: 0.2 + }, {validate: true})); + } } + } } \ No newline at end of file