Compare commits
2
Commits
9e2f2c61e7
...
a24726d7da
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a24726d7da | ||
|
|
bb68be14fa |
No files matched your search
@@ -2,6 +2,30 @@ import mongoose from 'mongoose';
|
||||
import { AuctionService } from './auction.service';
|
||||
|
||||
describe('AuctionService', () => {
|
||||
function requireRecord(
|
||||
value: unknown,
|
||||
label: string,
|
||||
): Record<string, unknown> {
|
||||
if (!value || typeof value !== 'object' || Array.isArray(value)) {
|
||||
throw new Error(`${label} must be an object.`);
|
||||
}
|
||||
return value as Record<string, unknown>;
|
||||
}
|
||||
|
||||
function requireArray(value: unknown, label: string): unknown[] {
|
||||
if (!Array.isArray(value)) {
|
||||
throw new Error(`${label} must be an array.`);
|
||||
}
|
||||
return value as unknown[];
|
||||
}
|
||||
|
||||
function parseJsonRecord(value: unknown, label: string) {
|
||||
if (typeof value !== 'string') {
|
||||
throw new Error(`${label} must be a JSON string.`);
|
||||
}
|
||||
return requireRecord(JSON.parse(value) as unknown, label);
|
||||
}
|
||||
|
||||
function createService(models: Record<string, unknown>) {
|
||||
const auctionHistoryModel = {
|
||||
findOne: jest.fn().mockReturnValue({
|
||||
@@ -1007,7 +1031,12 @@ describe('AuctionService', () => {
|
||||
);
|
||||
const transitionInput =
|
||||
auctionRedisCommandService.applyTransition.mock.calls[0][1];
|
||||
expect(JSON.parse(transitionInput.durabilityPayloadJson)).toMatchObject({
|
||||
expect(
|
||||
parseJsonRecord(
|
||||
transitionInput.durabilityPayloadJson,
|
||||
'durabilityPayloadJson',
|
||||
),
|
||||
).toMatchObject({
|
||||
afterAuctionMongoProjection: expect.objectContaining({
|
||||
phase: 'bidding',
|
||||
revision: 2,
|
||||
@@ -1178,17 +1207,40 @@ describe('AuctionService', () => {
|
||||
|
||||
const transitionInput =
|
||||
auctionRedisCommandService.applyTransition.mock.calls[0][1];
|
||||
const durabilityPayload = JSON.parse(transitionInput.durabilityPayloadJson);
|
||||
expect(durabilityPayload.snapshotBefore).toMatchObject({
|
||||
const durabilityPayload = parseJsonRecord(
|
||||
transitionInput.durabilityPayloadJson,
|
||||
'durabilityPayloadJson',
|
||||
);
|
||||
const snapshotBefore = requireRecord(
|
||||
durabilityPayload.snapshotBefore,
|
||||
'snapshotBefore',
|
||||
);
|
||||
const snapshotBeforeTeams = requireArray(
|
||||
snapshotBefore.auctionTeams,
|
||||
'snapshotBefore.auctionTeams',
|
||||
);
|
||||
const snapshotBeforeTeam = requireRecord(
|
||||
snapshotBeforeTeams[0],
|
||||
'snapshotBefore.auctionTeams[0]',
|
||||
);
|
||||
const afterAuctionMongoProjection = requireRecord(
|
||||
durabilityPayload.afterAuctionMongoProjection,
|
||||
'afterAuctionMongoProjection',
|
||||
);
|
||||
const projectedTeams = requireArray(
|
||||
afterAuctionMongoProjection.auctionTeams,
|
||||
'afterAuctionMongoProjection.auctionTeams',
|
||||
);
|
||||
const projectedTeam = requireRecord(
|
||||
projectedTeams[0],
|
||||
'afterAuctionMongoProjection.auctionTeams[0]',
|
||||
);
|
||||
expect(snapshotBefore).toMatchObject({
|
||||
phase: 'bidding',
|
||||
revision: 4,
|
||||
});
|
||||
expect(durabilityPayload.snapshotBefore.auctionTeams[0].members).toEqual(
|
||||
[],
|
||||
);
|
||||
expect(
|
||||
durabilityPayload.afterAuctionMongoProjection.auctionTeams[0].members,
|
||||
).toEqual([
|
||||
expect(snapshotBeforeTeam.members).toEqual([]);
|
||||
expect(projectedTeam.members).toEqual([
|
||||
expect.objectContaining({
|
||||
memberAcquisitionBidPointAmount: 120,
|
||||
userId: playerUserId.toString(),
|
||||
@@ -1396,7 +1448,12 @@ describe('AuctionService', () => {
|
||||
});
|
||||
const [, transitionInput] =
|
||||
auctionRedisCommandService.applyTransition.mock.calls.at(-1) ?? [];
|
||||
expect(JSON.parse(transitionInput.durabilityPayloadJson)).toMatchObject({
|
||||
expect(
|
||||
parseJsonRecord(
|
||||
transitionInput.durabilityPayloadJson,
|
||||
'durabilityPayloadJson',
|
||||
),
|
||||
).toMatchObject({
|
||||
afterAuctionMongoProjection: {
|
||||
matchSideEffectStatus: 'pending',
|
||||
phase: 'complete',
|
||||
@@ -2567,7 +2624,10 @@ describe('AuctionService', () => {
|
||||
durationSeconds: 30,
|
||||
mode: 'set-relative',
|
||||
});
|
||||
const durabilityPayload = JSON.parse(transitionInput.durabilityPayloadJson);
|
||||
const durabilityPayload = parseJsonRecord(
|
||||
transitionInput.durabilityPayloadJson,
|
||||
'durabilityPayloadJson',
|
||||
);
|
||||
expect(durabilityPayload).toMatchObject({
|
||||
auctionActionType: 'undo',
|
||||
historyMutation: {
|
||||
|
||||
@@ -429,8 +429,14 @@ export function applyCompetitionDomainInvariantIndexes(
|
||||
}
|
||||
}
|
||||
|
||||
export type CompetitionModelName =
|
||||
| 'competition'
|
||||
| 'competitionFact'
|
||||
| 'competitionOutbox'
|
||||
| 'tournamentCodeAssignment';
|
||||
|
||||
export const competitionModelDefinitions: Array<{
|
||||
name: string;
|
||||
name: CompetitionModelName;
|
||||
schema: mongoose.Schema;
|
||||
schemaName: string;
|
||||
}> = [
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
import { projectCompetition } from './competition-projector';
|
||||
import {
|
||||
CompetitionDomainError,
|
||||
type CompetitionDomainErrorCode,
|
||||
} from './domain-error';
|
||||
import { generateSeriesGraph } from './series-graph';
|
||||
|
||||
describe('projectCompetition', () => {
|
||||
@@ -323,20 +327,18 @@ describe('projectCompetition', () => {
|
||||
'team-1',
|
||||
);
|
||||
|
||||
expect(() =>
|
||||
projectCompetition({
|
||||
competitionId,
|
||||
revision: 1,
|
||||
projectorVersion: 1,
|
||||
teams,
|
||||
format,
|
||||
seriesGraph,
|
||||
facts: [{ ...accepted, seriesId: 'series-does-not-exist' }],
|
||||
}),
|
||||
).toThrow(
|
||||
expect.objectContaining({
|
||||
code: 'GAME_SERIES_MISMATCH',
|
||||
}),
|
||||
expectCompetitionDomainError(
|
||||
() =>
|
||||
projectCompetition({
|
||||
competitionId,
|
||||
revision: 1,
|
||||
projectorVersion: 1,
|
||||
teams,
|
||||
format,
|
||||
seriesGraph,
|
||||
facts: [{ ...accepted, seriesId: 'series-does-not-exist' }],
|
||||
}),
|
||||
'GAME_SERIES_MISMATCH',
|
||||
);
|
||||
});
|
||||
|
||||
@@ -356,20 +358,18 @@ describe('projectCompetition', () => {
|
||||
'team-1',
|
||||
);
|
||||
|
||||
expect(() =>
|
||||
projectCompetition({
|
||||
competitionId,
|
||||
revision: 1,
|
||||
projectorVersion: 1,
|
||||
teams,
|
||||
format,
|
||||
seriesGraph,
|
||||
facts: [{ ...accepted, gameSlotId: 'slot-does-not-exist' }],
|
||||
}),
|
||||
).toThrow(
|
||||
expect.objectContaining({
|
||||
code: 'GAME_SLOT_INVALID',
|
||||
}),
|
||||
expectCompetitionDomainError(
|
||||
() =>
|
||||
projectCompetition({
|
||||
competitionId,
|
||||
revision: 1,
|
||||
projectorVersion: 1,
|
||||
teams,
|
||||
format,
|
||||
seriesGraph,
|
||||
facts: [{ ...accepted, gameSlotId: 'slot-does-not-exist' }],
|
||||
}),
|
||||
'GAME_SLOT_INVALID',
|
||||
);
|
||||
});
|
||||
|
||||
@@ -382,36 +382,34 @@ describe('projectCompetition', () => {
|
||||
};
|
||||
const seriesGraph = generateSeriesGraph({ competitionId, teams, format });
|
||||
|
||||
expect(() =>
|
||||
projectCompetition({
|
||||
competitionId,
|
||||
revision: 1,
|
||||
projectorVersion: 1,
|
||||
teams,
|
||||
format,
|
||||
seriesGraph,
|
||||
facts: [
|
||||
{
|
||||
id: 'fact-unknown-adjudication-series',
|
||||
type: 'series-adjudicated',
|
||||
competitionId,
|
||||
revision: 1,
|
||||
ordinalWithinRevision: 1,
|
||||
commandId: 'command-unknown-adjudication-series',
|
||||
schemaVersion: 1,
|
||||
actor: { type: 'user' },
|
||||
occurredAt: new Date('2026-07-12T00:00:01.000Z'),
|
||||
recordedAt: new Date('2026-07-12T00:00:02.000Z'),
|
||||
seriesId: 'series-does-not-exist',
|
||||
decision: { type: 'administrative', winnerTeamId: 'team-1' },
|
||||
reason: 'Manual correction',
|
||||
},
|
||||
],
|
||||
}),
|
||||
).toThrow(
|
||||
expect.objectContaining({
|
||||
code: 'ADJUDICATION_INVALID',
|
||||
}),
|
||||
expectCompetitionDomainError(
|
||||
() =>
|
||||
projectCompetition({
|
||||
competitionId,
|
||||
revision: 1,
|
||||
projectorVersion: 1,
|
||||
teams,
|
||||
format,
|
||||
seriesGraph,
|
||||
facts: [
|
||||
{
|
||||
id: 'fact-unknown-adjudication-series',
|
||||
type: 'series-adjudicated',
|
||||
competitionId,
|
||||
revision: 1,
|
||||
ordinalWithinRevision: 1,
|
||||
commandId: 'command-unknown-adjudication-series',
|
||||
schemaVersion: 1,
|
||||
actor: { type: 'user' },
|
||||
occurredAt: new Date('2026-07-12T00:00:01.000Z'),
|
||||
recordedAt: new Date('2026-07-12T00:00:02.000Z'),
|
||||
seriesId: 'series-does-not-exist',
|
||||
decision: { type: 'administrative', winnerTeamId: 'team-1' },
|
||||
reason: 'Manual correction',
|
||||
},
|
||||
],
|
||||
}),
|
||||
'ADJUDICATION_INVALID',
|
||||
);
|
||||
});
|
||||
|
||||
@@ -617,3 +615,23 @@ interface GameSlotLike {
|
||||
id: string;
|
||||
ordinal: number;
|
||||
}
|
||||
|
||||
function expectCompetitionDomainError(
|
||||
action: () => unknown,
|
||||
expectedCode: CompetitionDomainErrorCode,
|
||||
): void {
|
||||
let thrown: unknown;
|
||||
try {
|
||||
action();
|
||||
} catch (error: unknown) {
|
||||
thrown = error;
|
||||
}
|
||||
|
||||
expect(thrown).toBeInstanceOf(CompetitionDomainError);
|
||||
if (!(thrown instanceof CompetitionDomainError)) {
|
||||
throw new Error(
|
||||
`Expected CompetitionDomainError, received ${String(thrown)}`,
|
||||
);
|
||||
}
|
||||
expect(thrown.code).toBe(expectedCode);
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
import {
|
||||
assertReversalPreview,
|
||||
buildReversalFacts,
|
||||
CompetitionReversalError,
|
||||
previewSeriesReversal,
|
||||
} from './competition-reversal';
|
||||
|
||||
@@ -19,18 +20,18 @@ describe('Competition reversal planning', () => {
|
||||
];
|
||||
|
||||
it('rejects strict reversal when a descendant has result activity', () => {
|
||||
expect(() =>
|
||||
previewSeriesReversal({
|
||||
competitionId: 'competition-1',
|
||||
revision: 2,
|
||||
seriesId: 'series-parent',
|
||||
mode: 'strict',
|
||||
graph,
|
||||
facts,
|
||||
assignments,
|
||||
}),
|
||||
).toThrow(
|
||||
expect.objectContaining({ code: 'REVERSAL_DESCENDANT_ACTIVITY' }),
|
||||
expectCompetitionReversalError(
|
||||
() =>
|
||||
previewSeriesReversal({
|
||||
competitionId: 'competition-1',
|
||||
revision: 2,
|
||||
seriesId: 'series-parent',
|
||||
mode: 'strict',
|
||||
graph,
|
||||
facts,
|
||||
assignments,
|
||||
}),
|
||||
'REVERSAL_DESCENDANT_ACTIVITY',
|
||||
);
|
||||
});
|
||||
|
||||
@@ -105,20 +106,22 @@ describe('Competition reversal planning', () => {
|
||||
assignments,
|
||||
});
|
||||
|
||||
expect(() =>
|
||||
assertReversalPreview(
|
||||
{
|
||||
competitionId: 'competition-1',
|
||||
revision: 3,
|
||||
seriesId: 'series-parent',
|
||||
mode: 'cascade',
|
||||
graph,
|
||||
facts,
|
||||
assignments,
|
||||
},
|
||||
preview.impactHash,
|
||||
),
|
||||
).toThrow(expect.objectContaining({ code: 'REVERSAL_PREVIEW_STALE' }));
|
||||
expectCompetitionReversalError(
|
||||
() =>
|
||||
assertReversalPreview(
|
||||
{
|
||||
competitionId: 'competition-1',
|
||||
revision: 3,
|
||||
seriesId: 'series-parent',
|
||||
mode: 'cascade',
|
||||
graph,
|
||||
facts,
|
||||
assignments,
|
||||
},
|
||||
preview.impactHash,
|
||||
),
|
||||
'REVERSAL_PREVIEW_STALE',
|
||||
);
|
||||
});
|
||||
|
||||
it('emits one append-only reversal fact for every active result fact', () => {
|
||||
@@ -160,6 +163,26 @@ describe('Competition reversal planning', () => {
|
||||
});
|
||||
});
|
||||
|
||||
function expectCompetitionReversalError(
|
||||
action: () => unknown,
|
||||
expectedCode: CompetitionReversalError['code'],
|
||||
): void {
|
||||
let thrown: unknown;
|
||||
try {
|
||||
action();
|
||||
} catch (error: unknown) {
|
||||
thrown = error;
|
||||
}
|
||||
|
||||
expect(thrown).toBeInstanceOf(CompetitionReversalError);
|
||||
if (!(thrown instanceof CompetitionReversalError)) {
|
||||
throw new Error(
|
||||
`Expected CompetitionReversalError, received ${String(thrown)}`,
|
||||
);
|
||||
}
|
||||
expect(thrown.code).toBe(expectedCode);
|
||||
}
|
||||
|
||||
function series(id: string, sources: Array<Record<string, unknown>>) {
|
||||
return {
|
||||
id,
|
||||
|
||||
@@ -2,7 +2,10 @@ import { Injectable, Logger, Scope, OnModuleInit } from '@nestjs/common';
|
||||
import mongoose from 'mongoose';
|
||||
import { applyMongoosePerformancePlugin } from '../observability/mongoose-performance.plugin';
|
||||
import { SecretService } from '../secret/secret.service';
|
||||
import { tournamentModelDefinitions, TournamentModelTypes } from './schema';
|
||||
import {
|
||||
tournamentModelDefinitions,
|
||||
type TournamentModelTypes,
|
||||
} from './schema';
|
||||
|
||||
export function resolveMongoDbName(nodeEnv = process.env.NODE_ENV): string {
|
||||
if (nodeEnv === 'prod') return 'lolympus';
|
||||
@@ -42,7 +45,8 @@ export class ConnectionService implements OnModuleInit {
|
||||
private connectionPromise: Promise<mongoose.Connection> | null = null;
|
||||
constructor(private readonly secretService: SecretService) {}
|
||||
|
||||
private tournamentModels: Map<string, mongoose.Model<any>> | null = null;
|
||||
private tournamentModels: Map<keyof TournamentModelTypes, unknown> | null =
|
||||
null;
|
||||
|
||||
public async getConnection(): Promise<mongoose.Connection> {
|
||||
if (
|
||||
@@ -89,14 +93,18 @@ export class ConnectionService implements OnModuleInit {
|
||||
modelKey: K,
|
||||
): Promise<mongoose.Model<TournamentModelTypes[K]>> {
|
||||
const connection = await this.getConnection();
|
||||
if (this.tournamentModels)
|
||||
return this.tournamentModels.get(modelKey) as mongoose.Model<
|
||||
TournamentModelTypes[K]
|
||||
>;
|
||||
if (this.tournamentModels) {
|
||||
return this.requireTournamentModel(this.tournamentModels, modelKey);
|
||||
}
|
||||
|
||||
const models = new Map<K, mongoose.Model<TournamentModelTypes[K]>>();
|
||||
const models = new Map<keyof TournamentModelTypes, unknown>();
|
||||
|
||||
tournamentModelDefinitions.forEach((modelDefinition) => {
|
||||
if (!(modelDefinition.schema instanceof mongoose.Schema)) {
|
||||
throw new Error(
|
||||
`Invalid Mongoose schema for model ${modelDefinition.name}.`,
|
||||
);
|
||||
}
|
||||
applyMongoosePerformancePlugin(modelDefinition.schema);
|
||||
// 이미 생성된 경우 컴파일 스킵.
|
||||
if (
|
||||
@@ -106,14 +114,14 @@ export class ConnectionService implements OnModuleInit {
|
||||
)
|
||||
) {
|
||||
models.set(
|
||||
modelDefinition.name as K,
|
||||
modelDefinition.name,
|
||||
connection.models[modelDefinition.name],
|
||||
);
|
||||
return;
|
||||
} else {
|
||||
models.set(
|
||||
modelDefinition.name as K,
|
||||
connection.model<TournamentModelTypes[K]>(
|
||||
modelDefinition.name,
|
||||
connection.model(
|
||||
modelDefinition.name,
|
||||
modelDefinition.schema,
|
||||
modelDefinition.schemaName,
|
||||
@@ -123,7 +131,18 @@ export class ConnectionService implements OnModuleInit {
|
||||
});
|
||||
|
||||
this.tournamentModels = models;
|
||||
return models.get(modelKey) as mongoose.Model<TournamentModelTypes[K]>;
|
||||
return this.requireTournamentModel(models, modelKey);
|
||||
}
|
||||
|
||||
private requireTournamentModel<K extends keyof TournamentModelTypes>(
|
||||
models: ReadonlyMap<keyof TournamentModelTypes, unknown>,
|
||||
modelKey: K,
|
||||
): mongoose.Model<TournamentModelTypes[K]> {
|
||||
const model = models.get(modelKey);
|
||||
if (model === undefined) {
|
||||
throw new Error(`Mongoose model ${modelKey} is not registered.`);
|
||||
}
|
||||
return model as mongoose.Model<TournamentModelTypes[K]>;
|
||||
}
|
||||
|
||||
public async createSession(
|
||||
|
||||
@@ -253,9 +253,7 @@ function migrateResult(result: Record<string, unknown>) {
|
||||
seriesResults.length > 0 ? seriesResults : buildSeries(games);
|
||||
|
||||
if (typeof migrated.winnerTeamIndex !== 'number') {
|
||||
const migratedSeriesResults = Array.isArray(migrated.seriesResults)
|
||||
? migrated.seriesResults
|
||||
: [];
|
||||
const migratedSeriesResults = asArray(migrated.seriesResults);
|
||||
migrated.winnerTeamIndex =
|
||||
resolveWinnerTeamIndex(migratedSeriesResults) ??
|
||||
(isSide(migrated.winnerSide)
|
||||
|
||||
+3
-1
@@ -117,7 +117,9 @@ function createDb(params: {
|
||||
function matchesFilter(doc: Doc, filter: Record<string, unknown>): boolean {
|
||||
const clauses = filter.$or;
|
||||
if (Array.isArray(clauses)) {
|
||||
return clauses.some((clause) => matchesFilter(doc, clause));
|
||||
return (clauses as unknown[]).some(
|
||||
(clause) => isRecord(clause) && matchesFilter(doc, clause),
|
||||
);
|
||||
}
|
||||
|
||||
return Object.entries(filter).every(([key, value]) => {
|
||||
|
||||
+6
-2
@@ -11,7 +11,11 @@ import {
|
||||
} from '../../../double-elimination/double-elimination.util';
|
||||
import { TOURNAMENT_CODE_EXPIRY_MARGIN_MS } from '../../../tournament-code/tournament-code.constants';
|
||||
import { ConnectionService } from '../connection.service';
|
||||
import type { MatchDocument, TournamentCodeDocument } from '../schema';
|
||||
import type {
|
||||
MatchDocument,
|
||||
TournamentCode,
|
||||
TournamentCodeDocument,
|
||||
} from '../schema';
|
||||
import { SecretModule } from '../../secret/secret.module';
|
||||
|
||||
interface CliOptions {
|
||||
@@ -334,7 +338,7 @@ function printPlan(plan: MatchRepairPlan) {
|
||||
async function applyPlan(
|
||||
match: MatchDocument,
|
||||
plan: MatchRepairPlan,
|
||||
TournamentCodeModel: mongoose.Model<any>,
|
||||
TournamentCodeModel: mongoose.Model<TournamentCode>,
|
||||
session: mongoose.ClientSession,
|
||||
) {
|
||||
if (plan.skippedReason) return;
|
||||
|
||||
@@ -2485,7 +2485,9 @@ MatchStatsSchema.index({ communityId: 1, userIds: 1 });
|
||||
MatchStatsSchema.index({ communityId: 1, userIds: 1, scheduledAt: -1 });
|
||||
MatchStatsSchema.index({ communityId: 1, championIds: 1 });
|
||||
|
||||
export const tournamentModelDefinitions: ModelDefinition[] = [
|
||||
export const tournamentModelDefinitions: Array<
|
||||
ModelDefinition & { name: keyof TournamentModelTypes }
|
||||
> = [
|
||||
...competitionModelDefinitions,
|
||||
{ name: 'identity', schema: IdentitySchema, schemaName: 'identity' },
|
||||
{ name: 'community', schema: CommunitySchema, schemaName: 'community' },
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
export interface ModelDefinition {
|
||||
name: string;
|
||||
schema: mongoose.Schema<any>;
|
||||
schema: unknown;
|
||||
schemaName?: string;
|
||||
}
|
||||
@@ -34,10 +34,13 @@ type SchemaWithPerformanceMarker = mongoose.Schema & {
|
||||
[PERFORMANCE_PLUGIN_APPLIED]?: boolean;
|
||||
};
|
||||
|
||||
export function applyMongoosePerformancePlugin(schema: mongoose.Schema): void {
|
||||
const markedSchema = schema as SchemaWithPerformanceMarker;
|
||||
if (markedSchema[PERFORMANCE_PLUGIN_APPLIED]) return;
|
||||
markedSchema[PERFORMANCE_PLUGIN_APPLIED] = true;
|
||||
export function applyMongoosePerformancePlugin(schemaValue: unknown): void {
|
||||
if (!(schemaValue instanceof mongoose.Schema)) {
|
||||
throw new TypeError('Mongoose performance plugin requires a Schema.');
|
||||
}
|
||||
const schema = schemaValue as SchemaWithPerformanceMarker;
|
||||
if (schema[PERFORMANCE_PLUGIN_APPLIED]) return;
|
||||
schema[PERFORMANCE_PLUGIN_APPLIED] = true;
|
||||
|
||||
schema.pre(QUERY_OPERATION_REGEX, function () {
|
||||
const query = this as QueryWithPerformanceState;
|
||||
|
||||
@@ -5,10 +5,12 @@ describe('MatchService', () => {
|
||||
function createServiceWithCreateModels() {
|
||||
const createdPayloads: Record<string, unknown>[] = [];
|
||||
const MatchModel = {
|
||||
create: jest.fn().mockImplementation(async (payload) => {
|
||||
createdPayloads.push(payload);
|
||||
return payload;
|
||||
}),
|
||||
create: jest
|
||||
.fn()
|
||||
.mockImplementation(async (payload: Record<string, unknown>) => {
|
||||
createdPayloads.push(payload);
|
||||
return payload;
|
||||
}),
|
||||
exists: jest.fn().mockResolvedValue(null),
|
||||
};
|
||||
const CommunityModel = {
|
||||
|
||||
Reference in new issue
Block a user