diff options
| author | syuilo <Syuilotan@yahoo.co.jp> | 2019-09-02 04:41:26 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-09-02 04:41:26 +0900 |
| commit | 96b2267cb8ed9744f933e0682449b35922df527a (patch) | |
| tree | 2c1b957b02ef54e494965c537ea7ebe0b9291728 /test | |
| parent | Update README.md [AUTOGEN] (#5377) (diff) | |
| download | misskey-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.ts | 56 |
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] + }, + }); + })); + }); }); |