summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorsyuilo <Syuilotan@yahoo.co.jp>2019-09-02 04:41:26 +0900
committerGitHub <noreply@github.com>2019-09-02 04:41:26 +0900
commit96b2267cb8ed9744f933e0682449b35922df527a (patch)
tree2c1b957b02ef54e494965c537ea7ebe0b9291728 /test
parentUpdate README.md [AUTOGEN] (#5377) (diff)
downloadmisskey-96b2267cb8ed9744f933e0682449b35922df527a.tar.gz
misskey-96b2267cb8ed9744f933e0682449b35922df527a.tar.bz2
misskey-96b2267cb8ed9744f933e0682449b35922df527a.zip
Chart resyncing (#5372)
* wip * Add test * Fix test * Insert moderation log * Add todo
Diffstat (limited to 'test')
-rw-r--r--test/chart.ts56
1 files changed, 56 insertions, 0 deletions
diff --git a/test/chart.ts b/test/chart.ts
index 28f34193fd..bd26f3bf36 100644
--- a/test/chart.ts
+++ b/test/chart.ts
@@ -320,4 +320,60 @@ describe('Chart', () => {
});
}));
});
+
+ describe('Resync', () => {
+ it('Can resync', async(async () => {
+ testChart.total = 1;
+
+ await testChart.resync();
+
+ const chartHours = await testChart.getChart('hour', 3);
+ const chartDays = await testChart.getChart('day', 3);
+
+ assert.deepStrictEqual(chartHours, {
+ foo: {
+ dec: [0, 0, 0],
+ inc: [0, 0, 0],
+ total: [1, 0, 0]
+ },
+ });
+
+ assert.deepStrictEqual(chartDays, {
+ foo: {
+ dec: [0, 0, 0],
+ inc: [0, 0, 0],
+ total: [1, 0, 0]
+ },
+ });
+ }));
+
+ it('Can resync (2)', async(async () => {
+ await testChart.increment();
+
+ clock.tick('01:00:00');
+
+ testChart.total = 100;
+
+ await testChart.resync();
+
+ const chartHours = await testChart.getChart('hour', 3);
+ const chartDays = await testChart.getChart('day', 3);
+
+ assert.deepStrictEqual(chartHours, {
+ foo: {
+ dec: [0, 0, 0],
+ inc: [0, 1, 0],
+ total: [100, 1, 0]
+ },
+ });
+
+ assert.deepStrictEqual(chartDays, {
+ foo: {
+ dec: [0, 0, 0],
+ inc: [1, 0, 0],
+ total: [100, 0, 0]
+ },
+ });
+ }));
+ });
});