mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-03-30 06:12:06 -07:00
fix: use explicit super args for MockDate constructors
This commit is contained in:
@@ -793,9 +793,13 @@ test('getTrendsDashboard month grouping spans every touched calendar month and k
|
||||
const RealDate = Date;
|
||||
|
||||
class MockDate extends Date {
|
||||
constructor(...args: ConstructorParameters<typeof Date>) {
|
||||
const resolvedArgs = args.length === 0 ? [new RealDate(2026, 2, 1, 12, 0, 0).getTime()] : args;
|
||||
return Reflect.construct(RealDate, resolvedArgs, new.target) as this;
|
||||
constructor(...args: any[]) {
|
||||
type MockDateArgs = [any, any, any, any, any, any, any];
|
||||
if (args.length === 0) {
|
||||
super(new RealDate(2026, 2, 1, 12, 0, 0).getTime());
|
||||
} else {
|
||||
super(...(args as MockDateArgs));
|
||||
}
|
||||
}
|
||||
|
||||
static override now(): number {
|
||||
@@ -1066,9 +1070,13 @@ test('getQueryHints computes weekly new-word cutoff from calendar midnights', ()
|
||||
const RealDate = Date;
|
||||
|
||||
class MockDate extends Date {
|
||||
constructor(...args: ConstructorParameters<typeof Date>) {
|
||||
const resolvedArgs = args.length === 0 ? [new RealDate(2026, 2, 15, 12, 0, 0).getTime()] : args;
|
||||
return Reflect.construct(RealDate, resolvedArgs, new.target) as this;
|
||||
constructor(...args: any[]) {
|
||||
type MockDateArgs = [any, any, any, any, any, any, any];
|
||||
if (args.length === 0) {
|
||||
super(new RealDate(2026, 2, 15, 12, 0, 0).getTime());
|
||||
} else {
|
||||
super(...(args as MockDateArgs));
|
||||
}
|
||||
}
|
||||
|
||||
static override now(): number {
|
||||
|
||||
Reference in New Issue
Block a user