merge: 자원 수입 문구 반올림을 main에 반영한다
This commit is contained in:
@@ -174,7 +174,10 @@ const processIncomeForNation = (
|
||||
world.updateNation(nation.id, { rice: next, meta: nextMeta });
|
||||
}
|
||||
|
||||
const incomeText = incomeValue.toLocaleString();
|
||||
// Ref keeps the fractional pre-flush value for the payout ratio and
|
||||
// prev_income_* metadata, but number_format() rounds the user-facing log
|
||||
// to the same integer precision as the persisted resource column.
|
||||
const incomeText = Math.round(incomeValue).toLocaleString('en-US');
|
||||
const incomeLog =
|
||||
type === 'gold' ? `이번 수입은 금 <C>${incomeText}</>입니다.` : `이번 수입은 쌀 <C>${incomeText}</>입니다.`;
|
||||
for (const general of nationGenerals) {
|
||||
|
||||
@@ -373,6 +373,13 @@ describe('core monthly event actions at the real month boundary', () => {
|
||||
await world.advanceMonth(new Date('0191-01-01T00:00:00.000Z'));
|
||||
|
||||
expect(world.getNationById(1)?.meta.prev_income_gold).toBe(157.5);
|
||||
expect(world.peekDirtyState().logs).toContainEqual(
|
||||
expect.objectContaining({
|
||||
generalId: 1,
|
||||
text: '이번 수입은 금 <C>158</>입니다.',
|
||||
})
|
||||
);
|
||||
expect(world.peekDirtyState().logs.map((entry) => entry.text).join('\n')).not.toContain('157.5');
|
||||
});
|
||||
|
||||
it('uses the Ref default nation resource floors when scenario const omits them', async () => {
|
||||
|
||||
@@ -23,6 +23,10 @@ const history = [
|
||||
'<span class="war_type war_type_attack">→</span><span class="ev_highlight">강조</span>' +
|
||||
'<span class="name" onclick="globalThis.__legacyLogXss=3">오염 이름</span></div>',
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
text: '이번 수입은 금 <C>158</>입니다.',
|
||||
},
|
||||
];
|
||||
|
||||
const publicResponse = (operation: string): unknown => {
|
||||
@@ -59,10 +63,12 @@ for (const viewport of [
|
||||
await page.goto('public');
|
||||
|
||||
const lines = page.locator('.recent-log-line');
|
||||
await expect(lines).toHaveCount(2);
|
||||
await expect(lines).toHaveCount(3);
|
||||
await expect(lines.nth(0).locator('b')).toHaveText('안전 강조');
|
||||
await expect(lines.nth(1).locator('.small_war_log .war_type_attack')).toHaveText('→');
|
||||
await expect(lines.nth(1).locator('.ev_highlight')).toHaveText('강조');
|
||||
await expect(lines.nth(2)).toHaveText('이번 수입은 금 158입니다.');
|
||||
await expect(lines.nth(2)).not.toContainText('157.5');
|
||||
await expect(lines.locator('script, img, svg, a, [onerror], [onclick], [style*="url"]')).toHaveCount(0);
|
||||
await expect(lines.nth(0)).toContainText('<img src=x onerror=');
|
||||
await expect(lines.nth(1)).toContainText('<span class="name" onclick=');
|
||||
|
||||
Reference in New Issue
Block a user