From 8946f3ea188b2e6a5d27d144940538205ad88214 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sat, 7 Mar 2020 01:10:13 +0900 Subject: [PATCH] Add test --- test/chart.ts | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/test/chart.ts b/test/chart.ts index 27cf2833e..6a04569a9 100644 --- a/test/chart.ts +++ b/test/chart.ts @@ -309,6 +309,35 @@ describe('Chart', () => { }); })); + it('Can specify offset (floor time)', async(async () => { + clock.tick('00:30:00'); + + await testChart.increment(); + + clock.tick('01:30:00'); + + await testChart.increment(); + + const chartHours = await testChart.getChart('hour', 3, 1); + const chartDays = await testChart.getChart('day', 3, 1); + + assert.deepStrictEqual(chartHours, { + foo: { + dec: [0, 0, 0], + inc: [1, 0, 0], + total: [1, 0, 0] + }, + }); + + assert.deepStrictEqual(chartDays, { + foo: { + dec: [0, 0, 0], + inc: [0, 0, 0], + total: [0, 0, 0] + }, + }); + })); + describe('Grouped', () => { it('Can updates', async(async () => { await testGroupedChart.increment('alice');