fix: load and persist legacy inheritance ranks
This commit is contained in:
@@ -213,7 +213,7 @@ integration('CreateManyNPC database persistence', () => {
|
||||
const ranks = await db.rankData.findMany({ where: { generalId: createdGeneralId } });
|
||||
// Legacy inserts 37 RankColumn rows. Core's canonical rank model
|
||||
// additionally projects experience/dedication/dex, so it owns 41.
|
||||
expect(ranks).toHaveLength(41);
|
||||
expect(ranks).toHaveLength(44);
|
||||
expect(ranks.every((rank) => rank.nationId === 0 && rank.value === 0)).toBe(true);
|
||||
expect(
|
||||
await db.logEntry.findMany({
|
||||
|
||||
@@ -320,7 +320,7 @@ integration('RaiseInvader database persistence', () => {
|
||||
});
|
||||
expect(await db.general.count({ where: { nationId: createdNationId } })).toBe(10);
|
||||
expect(await db.generalTurn.count({ where: { generalId: { gte: firstCreatedGeneralId } } })).toBe(300);
|
||||
expect(await db.rankData.count({ where: { generalId: { gte: firstCreatedGeneralId } } })).toBe(410);
|
||||
expect(await db.rankData.count({ where: { generalId: { gte: firstCreatedGeneralId } } })).toBe(440);
|
||||
expect(await db.nationTurn.count({ where: { nationId: createdNationId } })).toBe(48);
|
||||
expect(
|
||||
await db.diplomacy.count({
|
||||
|
||||
@@ -228,16 +228,14 @@ integration('monthly NPC support database persistence', () => {
|
||||
affinity: 999,
|
||||
meta: expect.objectContaining({ killturn: 70 }),
|
||||
});
|
||||
expect(
|
||||
await db.troop.findUniqueOrThrow({ where: { troopLeaderId: generalId } })
|
||||
).toMatchObject({
|
||||
expect(await db.troop.findUniqueOrThrow({ where: { troopLeaderId: generalId } })).toMatchObject({
|
||||
nationId,
|
||||
name: '㉥부대장 41',
|
||||
});
|
||||
const turns = await db.generalTurn.findMany({ where: { generalId } });
|
||||
expect(turns).toHaveLength(30);
|
||||
expect(new Set(turns.map((turn) => turn.actionCode))).toEqual(new Set(['che_집합']));
|
||||
expect(await db.rankData.count({ where: { generalId } })).toBe(41);
|
||||
expect(await db.rankData.count({ where: { generalId } })).toBe(44);
|
||||
expect((await db.worldState.findUniqueOrThrow({ where: { id: stateRow.id } })).meta).toMatchObject({
|
||||
lastNPCTroopLeaderID: 41,
|
||||
});
|
||||
|
||||
@@ -65,10 +65,7 @@ const map: MapDefinition = {
|
||||
level: 5,
|
||||
region: 1,
|
||||
position: { x: index, y: 0 },
|
||||
connections: [
|
||||
...(index > 0 ? [rows[index - 1]!] : []),
|
||||
...(index + 1 < rows.length ? [rows[index + 1]!] : []),
|
||||
],
|
||||
connections: [...(index > 0 ? [rows[index - 1]!] : []), ...(index + 1 < rows.length ? [rows[index + 1]!] : [])],
|
||||
max: {
|
||||
population: 50_000,
|
||||
agriculture: 5_000,
|
||||
@@ -294,7 +291,7 @@ integration('RaiseNPCNation database persistence', () => {
|
||||
});
|
||||
expect(await db.generalTurn.count({ where: { generalId: createdGeneralId } })).toBe(30);
|
||||
expect(await db.nationTurn.count({ where: { nationId: createdNationId } })).toBe(48);
|
||||
expect(await db.rankData.count({ where: { generalId: createdGeneralId } })).toBe(41);
|
||||
expect(await db.rankData.count({ where: { generalId: createdGeneralId } })).toBe(44);
|
||||
expect(
|
||||
await db.diplomacy.count({
|
||||
where: {
|
||||
|
||||
@@ -53,10 +53,7 @@ integration('RegNPC database persistence', () => {
|
||||
const clean = async () => {
|
||||
await db.logEntry.deleteMany({
|
||||
where: {
|
||||
OR: [
|
||||
{ generalId: createdGeneralId },
|
||||
{ year: 200, month: 1, text: { contains: 'ⓝ저장장수' } },
|
||||
],
|
||||
OR: [{ generalId: createdGeneralId }, { year: 200, month: 1, text: { contains: 'ⓝ저장장수' } }],
|
||||
},
|
||||
});
|
||||
await db.generalTurn.deleteMany({ where: { generalId: createdGeneralId } });
|
||||
@@ -207,7 +204,7 @@ integration('RegNPC database persistence', () => {
|
||||
expect(turns).toHaveLength(30);
|
||||
expect(new Set(turns.map((turn) => turn.actionCode))).toEqual(new Set(['휴식']));
|
||||
const ranks = await db.rankData.findMany({ where: { generalId: createdGeneralId } });
|
||||
expect(ranks).toHaveLength(41);
|
||||
expect(ranks).toHaveLength(44);
|
||||
expect(ranks.every((rank) => rank.nationId === 0 && rank.value === 0)).toBe(true);
|
||||
expect(
|
||||
await db.logEntry.findFirst({
|
||||
|
||||
Reference in New Issue
Block a user