This commit is contained in:
syuilo 2020-03-07 11:23:31 +09:00
parent 49a5b4eb14
commit 917726fecc
16 changed files with 96 additions and 105 deletions

View file

@ -86,8 +86,8 @@ describe('Chart', () => {
it('Can updates', async(async () => {
await testChart.increment();
const chartHours = await testChart.getChart('hour', 3, 0);
const chartDays = await testChart.getChart('day', 3, 0);
const chartHours = await testChart.getChart('hour', 3, null);
const chartDays = await testChart.getChart('day', 3, null);
assert.deepStrictEqual(chartHours, {
foo: {
@ -109,8 +109,8 @@ describe('Chart', () => {
it('Can updates (dec)', async(async () => {
await testChart.decrement();
const chartHours = await testChart.getChart('hour', 3, 0);
const chartDays = await testChart.getChart('day', 3, 0);
const chartHours = await testChart.getChart('hour', 3, null);
const chartDays = await testChart.getChart('day', 3, null);
assert.deepStrictEqual(chartHours, {
foo: {
@ -130,8 +130,8 @@ describe('Chart', () => {
}));
it('Empty chart', async(async () => {
const chartHours = await testChart.getChart('hour', 3, 0);
const chartDays = await testChart.getChart('day', 3, 0);
const chartHours = await testChart.getChart('hour', 3, null);
const chartDays = await testChart.getChart('day', 3, null);
assert.deepStrictEqual(chartHours, {
foo: {
@ -155,8 +155,8 @@ describe('Chart', () => {
await testChart.increment();
await testChart.increment();
const chartHours = await testChart.getChart('hour', 3, 0);
const chartDays = await testChart.getChart('day', 3, 0);
const chartHours = await testChart.getChart('hour', 3, null);
const chartDays = await testChart.getChart('day', 3, null);
assert.deepStrictEqual(chartHours, {
foo: {
@ -182,8 +182,8 @@ describe('Chart', () => {
await testChart.increment();
const chartHours = await testChart.getChart('hour', 3, 0);
const chartDays = await testChart.getChart('day', 3, 0);
const chartHours = await testChart.getChart('hour', 3, null);
const chartDays = await testChart.getChart('day', 3, null);
assert.deepStrictEqual(chartHours, {
foo: {
@ -209,8 +209,8 @@ describe('Chart', () => {
await testChart.increment();
const chartHours = await testChart.getChart('hour', 3, 0);
const chartDays = await testChart.getChart('day', 3, 0);
const chartHours = await testChart.getChart('hour', 3, null);
const chartDays = await testChart.getChart('day', 3, null);
assert.deepStrictEqual(chartHours, {
foo: {
@ -235,8 +235,8 @@ describe('Chart', () => {
clock.tick('05:00:00');
const chartHours = await testChart.getChart('hour', 3, 0);
const chartDays = await testChart.getChart('day', 3, 0);
const chartHours = await testChart.getChart('hour', 3, null);
const chartDays = await testChart.getChart('day', 3, null);
assert.deepStrictEqual(chartHours, {
foo: {
@ -262,8 +262,8 @@ describe('Chart', () => {
clock.tick('05:00:00');
await testChart.increment();
const chartHours = await testChart.getChart('hour', 3, 0);
const chartDays = await testChart.getChart('day', 3, 0);
const chartHours = await testChart.getChart('hour', 3, null);
const chartDays = await testChart.getChart('day', 3, null);
assert.deepStrictEqual(chartHours, {
foo: {
@ -289,8 +289,8 @@ describe('Chart', () => {
await testChart.increment();
const chartHours = await testChart.getChart('hour', 3, 1);
const chartDays = await testChart.getChart('day', 3, 1);
const chartHours = await testChart.getChart('hour', 3, new Date(Date.UTC(2000, 0, 1, 0, 0, 0)));
const chartDays = await testChart.getChart('day', 3, new Date(Date.UTC(2000, 0, 1, 0, 0, 0)));
assert.deepStrictEqual(chartHours, {
foo: {
@ -303,8 +303,8 @@ describe('Chart', () => {
assert.deepStrictEqual(chartDays, {
foo: {
dec: [0, 0, 0],
inc: [0, 0, 0],
total: [0, 0, 0]
inc: [2, 0, 0],
total: [2, 0, 0]
},
});
}));
@ -318,8 +318,8 @@ describe('Chart', () => {
await testChart.increment();
const chartHours = await testChart.getChart('hour', 3, 1);
const chartDays = await testChart.getChart('day', 3, 1);
const chartHours = await testChart.getChart('hour', 3, new Date(Date.UTC(2000, 0, 1, 0, 0, 0)));
const chartDays = await testChart.getChart('day', 3, new Date(Date.UTC(2000, 0, 1, 0, 0, 0)));
assert.deepStrictEqual(chartHours, {
foo: {
@ -342,10 +342,10 @@ describe('Chart', () => {
it('Can updates', async(async () => {
await testGroupedChart.increment('alice');
const aliceChartHours = await testGroupedChart.getChart('hour', 3, 0, 'alice');
const aliceChartDays = await testGroupedChart.getChart('day', 3, 0, 'alice');
const bobChartHours = await testGroupedChart.getChart('hour', 3, 0, 'bob');
const bobChartDays = await testGroupedChart.getChart('day', 3, 0, 'bob');
const aliceChartHours = await testGroupedChart.getChart('hour', 3, null, 'alice');
const aliceChartDays = await testGroupedChart.getChart('day', 3, null, 'alice');
const bobChartHours = await testGroupedChart.getChart('hour', 3, null, 'bob');
const bobChartDays = await testGroupedChart.getChart('day', 3, null, 'bob');
assert.deepStrictEqual(aliceChartHours, {
foo: {
@ -387,8 +387,8 @@ describe('Chart', () => {
await testUniqueChart.uniqueIncrement('alice');
await testUniqueChart.uniqueIncrement('bob');
const chartHours = await testUniqueChart.getChart('hour', 3, 0);
const chartDays = await testUniqueChart.getChart('day', 3, 0);
const chartHours = await testUniqueChart.getChart('hour', 3, null);
const chartDays = await testUniqueChart.getChart('day', 3, null);
assert.deepStrictEqual(chartHours, {
foo: [2, 0, 0],
@ -406,8 +406,8 @@ describe('Chart', () => {
await testChart.resync();
const chartHours = await testChart.getChart('hour', 3, 0);
const chartDays = await testChart.getChart('day', 3, 0);
const chartHours = await testChart.getChart('hour', 3, null);
const chartDays = await testChart.getChart('day', 3, null);
assert.deepStrictEqual(chartHours, {
foo: {
@ -435,8 +435,8 @@ describe('Chart', () => {
await testChart.resync();
const chartHours = await testChart.getChart('hour', 3, 0);
const chartDays = await testChart.getChart('day', 3, 0);
const chartHours = await testChart.getChart('hour', 3, null);
const chartDays = await testChart.getChart('day', 3, null);
assert.deepStrictEqual(chartHours, {
foo: {