-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for valueType: Array, see #195
- Loading branch information
Showing
2 changed files
with
17 additions
and
16 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,24 @@ | ||
// Copyright 2017-2018, University of Colorado Boulder | ||
// Copyright 2017-2019, University of Colorado Boulder | ||
|
||
/** | ||
* QUnit tests for Validator | ||
* | ||
* @author Sam Reid (PhET Interactive Simulations) | ||
*/ | ||
define( function( require ) { | ||
define( require => { | ||
'use strict'; | ||
|
||
// modules | ||
var Validator = require( 'AXON/Validator' ); | ||
const Validator = require( 'AXON/Validator' ); | ||
|
||
QUnit.module( 'Validator' ); | ||
|
||
// Note that many validation tests are in PropertyTests | ||
QUnit.test( 'Test Validator', function( assert ) { | ||
assert.ok( true, 'so we have at least 1 test in this set' ); | ||
QUnit.test( 'Test Validator', assert => { | ||
|
||
assert.ok( Validator.validate( 3, { validValues: [ 1, 2, 3 ] } ) ); | ||
|
||
window.assert && assert.throws( function() { | ||
assert.ok( !Validator.validate( 4, { validValues: [ 1, 2, 3 ] } ) ); | ||
}, 'should throw assertion error' ); | ||
assert.ok( Validator.validate( [], { valueType: Array } ) ); | ||
window.assert && assert.throws( () => !Validator.validate( 4, { validValues: [ 1, 2, 3 ] } ), 'invalid number' ); | ||
window.assert && assert.throws( () => !Validator.validate( 'hello', { valueType: Array } ), 'string isn\'t Array' ); | ||
} ); | ||
} ); |