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