fix(test): fix chart test
This commit is contained in:
parent
a2eac9fff6
commit
89174904bc
5 changed files with 18 additions and 16 deletions
|
@ -2,8 +2,8 @@ import { Injectable, Inject } from '@nestjs/common';
|
|||
import { DataSource } from 'typeorm';
|
||||
import { AppLockService } from '@/core/AppLockService.js';
|
||||
import { DI } from '@/di-symbols.js';
|
||||
import Logger from '@/logger.js';
|
||||
import Chart from '../core.js';
|
||||
import { ChartLoggerService } from '../ChartLoggerService.js';
|
||||
import { name, schema } from './entities/test-grouped.js';
|
||||
import type { KVs } from '../core.js';
|
||||
|
||||
|
@ -20,9 +20,9 @@ export default class TestGroupedChart extends Chart<typeof schema> {
|
|||
private db: DataSource,
|
||||
|
||||
private appLockService: AppLockService,
|
||||
private chartLoggerService: ChartLoggerService,
|
||||
private logger: Logger,
|
||||
) {
|
||||
super(db, (k) => appLockService.getChartInsertLock(k), chartLoggerService.logger, name, schema, true);
|
||||
super(db, (k) => appLockService.getChartInsertLock(k), logger, name, schema, true);
|
||||
}
|
||||
|
||||
protected async tickMajor(group: string): Promise<Partial<KVs<typeof schema>>> {
|
||||
|
|
|
@ -2,8 +2,8 @@ import { Injectable, Inject } from '@nestjs/common';
|
|||
import { DataSource } from 'typeorm';
|
||||
import { AppLockService } from '@/core/AppLockService.js';
|
||||
import { DI } from '@/di-symbols.js';
|
||||
import Logger from '@/logger.js';
|
||||
import Chart from '../core.js';
|
||||
import { ChartLoggerService } from '../ChartLoggerService.js';
|
||||
import { name, schema } from './entities/test-intersection.js';
|
||||
import type { KVs } from '../core.js';
|
||||
|
||||
|
@ -18,9 +18,9 @@ export default class TestIntersectionChart extends Chart<typeof schema> {
|
|||
private db: DataSource,
|
||||
|
||||
private appLockService: AppLockService,
|
||||
private chartLoggerService: ChartLoggerService,
|
||||
private logger: Logger,
|
||||
) {
|
||||
super(db, (k) => appLockService.getChartInsertLock(k), chartLoggerService.logger, name, schema);
|
||||
super(db, (k) => appLockService.getChartInsertLock(k), logger, name, schema);
|
||||
}
|
||||
|
||||
protected async tickMajor(): Promise<Partial<KVs<typeof schema>>> {
|
||||
|
|
|
@ -2,8 +2,8 @@ import { Injectable, Inject } from '@nestjs/common';
|
|||
import { DataSource } from 'typeorm';
|
||||
import { AppLockService } from '@/core/AppLockService.js';
|
||||
import { DI } from '@/di-symbols.js';
|
||||
import Logger from '@/logger.js';
|
||||
import Chart from '../core.js';
|
||||
import { ChartLoggerService } from '../ChartLoggerService.js';
|
||||
import { name, schema } from './entities/test-unique.js';
|
||||
import type { KVs } from '../core.js';
|
||||
|
||||
|
@ -18,9 +18,9 @@ export default class TestUniqueChart extends Chart<typeof schema> {
|
|||
private db: DataSource,
|
||||
|
||||
private appLockService: AppLockService,
|
||||
private chartLoggerService: ChartLoggerService,
|
||||
private logger: Logger,
|
||||
) {
|
||||
super(db, (k) => appLockService.getChartInsertLock(k), chartLoggerService.logger, name, schema);
|
||||
super(db, (k) => appLockService.getChartInsertLock(k), logger, name, schema);
|
||||
}
|
||||
|
||||
protected async tickMajor(): Promise<Partial<KVs<typeof schema>>> {
|
||||
|
|
|
@ -2,8 +2,8 @@ import { Injectable, Inject } from '@nestjs/common';
|
|||
import { DataSource } from 'typeorm';
|
||||
import { AppLockService } from '@/core/AppLockService.js';
|
||||
import { DI } from '@/di-symbols.js';
|
||||
import Logger from '@/logger.js';
|
||||
import Chart from '../core.js';
|
||||
import { ChartLoggerService } from '../ChartLoggerService.js';
|
||||
import { name, schema } from './entities/test.js';
|
||||
import type { KVs } from '../core.js';
|
||||
|
||||
|
@ -20,9 +20,9 @@ export default class TestChart extends Chart<typeof schema> {
|
|||
private db: DataSource,
|
||||
|
||||
private appLockService: AppLockService,
|
||||
private chartLoggerService: ChartLoggerService,
|
||||
private logger: Logger,
|
||||
) {
|
||||
super(db, (k) => appLockService.getChartInsertLock(k), chartLoggerService.logger, name, schema);
|
||||
super(db, (k) => appLockService.getChartInsertLock(k), logger, name, schema);
|
||||
}
|
||||
|
||||
protected async tickMajor(): Promise<Partial<KVs<typeof schema>>> {
|
||||
|
|
|
@ -14,6 +14,7 @@ import { entity as TestUniqueChartEntity } from '@/core/chart/charts/entities/te
|
|||
import { entity as TestIntersectionChartEntity } from '@/core/chart/charts/entities/test-intersection.js';
|
||||
import { loadConfig } from '@/config.js';
|
||||
import type { AppLockService } from '@/core/AppLockService';
|
||||
import Logger from '@/logger.js';
|
||||
|
||||
describe('Chart', () => {
|
||||
const config = loadConfig();
|
||||
|
@ -57,10 +58,11 @@ describe('Chart', () => {
|
|||
|
||||
await db.initialize();
|
||||
|
||||
testChart = new TestChart(db, appLockService);
|
||||
testGroupedChart = new TestGroupedChart(db, appLockService);
|
||||
testUniqueChart = new TestUniqueChart(db, appLockService);
|
||||
testIntersectionChart = new TestIntersectionChart(db, appLockService);
|
||||
const logger = new Logger('chart'); // TODO: モックにする
|
||||
testChart = new TestChart(db, appLockService, logger);
|
||||
testGroupedChart = new TestGroupedChart(db, appLockService, logger);
|
||||
testUniqueChart = new TestUniqueChart(db, appLockService, logger);
|
||||
testIntersectionChart = new TestIntersectionChart(db, appLockService, logger);
|
||||
|
||||
clock = lolex.install({
|
||||
now: new Date(Date.UTC(2000, 0, 1, 0, 0, 0)),
|
||||
|
|
Loading…
Reference in a new issue