Skip to content

Commit

Permalink
group tests in console where possible
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanve committed Sep 11, 2016
1 parent 538b42e commit 1c7c432
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
3 changes: 2 additions & 1 deletion package.json
Expand Up @@ -30,7 +30,8 @@
"devDependencies": {
"actual": "^0.2.0",
"aok": "^1.9.0",
"jshint": "^2.9.3"
"jshint": "^2.9.3",
"sos": "0.0.1"
},
"jshintConfig": {
"asi": true,
Expand Down
1 change: 1 addition & 0 deletions test.html
Expand Up @@ -11,5 +11,6 @@ <h1>Tests</h1>

<script src="res.js"></script>
<script src="node_modules/actual/actual.js"></script>
<script src="node_modules/sos/sos.js"></script>
<script src="node_modules/aok/aok.js"></script>
<script src="test.js"></script>
5 changes: 4 additions & 1 deletion test.js
@@ -1,6 +1,7 @@
!function(root, name) {
var common = typeof module != 'undefined' && !!module.exports
var actual = common ? require('actual') : root.actual
var sos = common ? require('sos') : root.sos
var aok = common ? require('aok') : root.aok
var res = common ? require('./') : root[name]
var precision = 1/20
Expand All @@ -16,19 +17,21 @@
}

aok.pass(['dpi', 'dpcm', 'dppx'], function(unit) {
sos('group', unit)
var rNum = res[unit]()
var aNum = actual('resolution', unit)
aok(unit + ' return', isNatural(rNum))
if (rNum && aNum) aok(unit + ' accuracy', isClose(rNum, aNum))
aok.info('res ' + unit + ': ' + rNum)
aok.info('actual ' + unit + ': ' + aNum)
sos('groupEnd')
})

aok('unitconversion', function() {
if (res.dpi() < res.dpcm()) return false
if (96*res.dppx() !== res.dpi()) return false
return isClose(2.54*res.dpcm(), res.dpi())
})

aok.log('All tests passed :)')
}(this, 'res');

0 comments on commit 1c7c432

Please sign in to comment.