This repository was archived by the owner on Jul 1, 2026. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbuildWorkshopSheetUpdates.test.ts
More file actions
74 lines (70 loc) · 2.31 KB
/
Copy pathbuildWorkshopSheetUpdates.test.ts
File metadata and controls
74 lines (70 loc) · 2.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
import { describe, expect, it } from 'vitest'
import {
buildWorkshopEnhanceSheetUpdates,
buildWorkshopSheetUpdates,
} from './buildWorkshopSheetUpdates'
const workshopLayout = {
unlockedCol: 1,
nameCol: 2,
levelCol: 3,
startRow: 5,
endRow: 9,
}
describe('buildWorkshopSheetUpdates', () => {
it('writes unlocked (B) and farming level (D) for workshop rows', () => {
const batch = buildWorkshopSheetUpdates(
'Master Sheet',
[
{ rowIndex: 6, name: 'Damage', upgradeId: 'damageLevel' },
{ rowIndex: 7, name: 'Coins - Kill Bonus', upgradeId: 'coinsKillBonusLevel' },
{ rowIndex: 8, name: 'Interest - Wave', upgradeId: 'interestPerWaveLevel' },
],
{
damageLevel: 5640,
coinsKillBonusLevel: 0,
interestPerWaveLevel: 12,
},
workshopLayout,
)
expect(batch).toEqual(
expect.arrayContaining([
{ range: "'Master Sheet'!D6", values: [['5640']] },
{ range: "'Master Sheet'!B7", values: [['FALSE']] },
{ range: "'Master Sheet'!D7", values: [['0']] },
{ range: "'Master Sheet'!B8", values: [['TRUE']] },
{ range: "'Master Sheet'!D8", values: [['12']] },
]),
)
expect(batch.some((entry) => entry.range === "'Master Sheet'!B6")).toBe(false)
})
it('skips column B for always-unlocked basics (Health / Health Regen)', () => {
const batch = buildWorkshopSheetUpdates(
'Master Sheet',
[
{ rowIndex: 20, name: 'Health', upgradeId: 'healthLevel' },
{ rowIndex: 21, name: 'Health Regen', upgradeId: 'healthRegenLevel' },
],
{ healthLevel: 120, healthRegenLevel: 45 },
workshopLayout,
)
expect(batch).toEqual([
{ range: "'Master Sheet'!D20", values: [['120']] },
{ range: "'Master Sheet'!D21", values: [['45']] },
])
})
it('writes enhancement farming levels to column R', () => {
const batch = buildWorkshopEnhanceSheetUpdates(
'Master Sheet',
[
{ rowIndex: 6, name: 'Damage +' },
{ rowIndex: 7, name: 'Health +' },
],
{ enhanceDamageLevel: 40, enhanceHealthLevel: 25 },
{ nameCol: 15, levelCol: 17, startRow: 5, endRow: 8 },
)
expect(batch).toEqual([
{ range: "'Master Sheet'!R6", values: [['40']] },
{ range: "'Master Sheet'!R7", values: [['25']] },
])
})
})