-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rewrite string getting code for simplicity, fix reportUnusedStrings, #…
- Loading branch information
Showing
8 changed files
with
105 additions
and
113 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 |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// Copyright 2019, University of Colorado Boulder | ||
|
||
/** | ||
* Tests for ChipperStringUtils | ||
* @author Michael Kauzmann (PhET Interactive Simulations) | ||
*/ | ||
|
||
/* eslint-env node*/ | ||
'use strict'; | ||
|
||
const ChipperStringUtils = require( './ChipperStringUtils' ); | ||
const qunit = require( 'qunit' ); | ||
qunit.module( 'ChipperStringUtils' ); | ||
|
||
|
||
qunit.test( 'forEachString', assert => { | ||
const map1 = { | ||
x: { value: 'x' }, | ||
y: { | ||
value: 'y', | ||
z: { value: 'z' } | ||
}, | ||
intermediary: { | ||
a: { value: 'a' }, | ||
b: { value: 'b' }, | ||
intermediary2: { | ||
c: { value: 'c' } | ||
} | ||
} | ||
}; | ||
|
||
let count = 0; | ||
const expectedKeys = [ | ||
'x', | ||
'y', | ||
'y.z', | ||
'intermediary.a', | ||
'intermediary.b', | ||
'intermediary.intermediary2.c' | ||
]; | ||
ChipperStringUtils.forEachString( map1, key => { | ||
count++; | ||
const keyIndex = expectedKeys.indexOf( key ); | ||
assert.ok( keyIndex >= 0, 'unexpected key:' + key ); | ||
expectedKeys.splice( keyIndex, 1 ); // just remove the single item | ||
} ); | ||
assert.ok( expectedKeys.length === 0, 'all keys should be accounted for' ); | ||
assert.ok( count === 6, 'should be three string' ); | ||
assert.ok( true, 'success' ); | ||
} ); |
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
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
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// Copyright 2019, University of Colorado Boulder | ||
|
||
/** | ||
* launch point to load any tests located around the chipper repo. This is to support running `qunit` with no args | ||
* from the top level of chipper, as is the recommended way to run chipper tests. | ||
* | ||
* @author Michael Kauzmann (PhET Interactive Simulations) | ||
*/ | ||
|
||
'use strict'; | ||
|
||
require( '../js/common/ChipperStringUtilTests' ); |