forked from tomkr/waterstanden
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Get the last numeric data point from RWS data. Fixes tomkr#1
- Loading branch information
Tom Kruijsen
committed
Jan 18, 2014
1 parent
4c2dccf
commit 06990cc
Showing
2 changed files
with
29 additions
and
3 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,20 @@ | ||
Waterdata = require('../lib/lib').Waterdata | ||
assert = require 'assert' | ||
|
||
describe 'handle rws water data', -> | ||
|
||
it 'should get the last value if it is numeric', -> | ||
result = Waterdata.getLastValue(['0','1','2','3','4','5']) | ||
assert.equal result, 5 | ||
|
||
it 'should return a numeric value if the last one is not', -> | ||
result = Waterdata.getLastValue(['0','1','2','3','4','f']) | ||
assert.equal result, 4 | ||
|
||
it 'should not return an empty string', -> | ||
result = Waterdata.getLastValue(['0','1','2','3','4','']) | ||
assert.equal result, 4 | ||
|
||
it 'should return a dash if there is no numeric value', -> | ||
result = Waterdata.getLastValue(['n','n','n','n','f']) | ||
assert.equal result, '-' |