forked from nightscout/cgm-remote-monitor
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding some test coverage for /lib/client/renderer.js
- Loading branch information
1 parent
1c387b8
commit 68af094
Showing
2 changed files
with
31 additions
and
1 deletion.
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,29 @@ | ||
'use strict'; | ||
|
||
require('should'); | ||
let _ = require('lodash'); | ||
|
||
let renderer = require('../lib/client/renderer'); | ||
const MAX_DELTA = 0.0001; | ||
const PREV_CHART_WIDTHS = [ | ||
{ width: 400, expectedScale: 3.5 } | ||
, { width: 500, expectedScale: 2.625 } | ||
, { width: 900, expectedScale: 1.75 } | ||
]; | ||
|
||
describe('renderer', () => { | ||
describe('bubbleScale', () => { | ||
_.forEach(PREV_CHART_WIDTHS, (prev) => { | ||
describe(`prevChartWidth < ${prev.width}`, () => { | ||
let mockClient = { | ||
utils: true | ||
, chart: { prevChartWidth: prev.width } | ||
, foucusRangeMS: true | ||
}; | ||
it('scales correctly', () => { | ||
renderer(mockClient, {}).bubbleScale().should.be.approximately(prev.expectedScale, MAX_DELTA); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); |