summaryrefslogtreecommitdiff
path: root/test/chart.ts
diff options
context:
space:
mode:
authorsyuilo <Syuilotan@yahoo.co.jp>2020-03-07 01:10:13 +0900
committersyuilo <Syuilotan@yahoo.co.jp>2020-03-07 01:10:13 +0900
commit8946f3ea188b2e6a5d27d144940538205ad88214 (patch)
tree05ffa66820c02b05ff306b7ed1424cbebb8ab7a1 /test/chart.ts
parentResolve #6137 (diff)
downloadmisskey-8946f3ea188b2e6a5d27d144940538205ad88214.tar.gz
misskey-8946f3ea188b2e6a5d27d144940538205ad88214.tar.bz2
misskey-8946f3ea188b2e6a5d27d144940538205ad88214.zip
Add test
Diffstat (limited to 'test/chart.ts')
-rw-r--r--test/chart.ts29
1 files changed, 29 insertions, 0 deletions
diff --git a/test/chart.ts b/test/chart.ts
index 27cf2833e2..6a04569a90 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');