forked from oldschoolgg/oldschoolbot
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test / fix degradeable items (oldschoolgg#6195)
- Loading branch information
Showing
3 changed files
with
68 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import { expect, test } from 'vitest'; | ||
|
||
import { COXMaxMageGear, COXMaxMeleeGear, COXMaxRangeGear } from '../../../src/lib/data/cox'; | ||
import { Bank, itemID, resolveItems } from '../../../src/lib/util'; | ||
import { raidCommand } from '../../../src/mahoji/commands/raid'; | ||
import { mockClient, mockUser } from '../util'; | ||
|
||
test('CoX ', async () => { | ||
const client = await mockClient(); | ||
|
||
const user = await mockUser({ | ||
rangeGear: resolveItems(['Venator bow']), | ||
rangeLevel: 70, | ||
venatorBowCharges: 1000, | ||
slayerLevel: 70 | ||
}); | ||
await user.max(); | ||
|
||
await user.update({ | ||
tum_shadow_charges: 10000, | ||
scythe_of_vitur_charges: 100, | ||
gear_mage: COXMaxMageGear.raw() as any, | ||
gear_melee: COXMaxMeleeGear.raw() as any, | ||
gear_range: { | ||
...(COXMaxRangeGear.raw() as any), | ||
ammo: { | ||
item: itemID('Dragon arrow'), | ||
quantity: 10000 | ||
} | ||
}, | ||
bank: new Bank() | ||
.add('Shark', 10000) | ||
.add('Stamina potion(4)', 10000) | ||
.add('Super restore(4)', 10000) | ||
.add('Saradomin brew(4)', 10000) | ||
.toJSON() | ||
}); | ||
await user.equip('melee', resolveItems(['Scythe of vitur'])); | ||
const res = await user.runCommand( | ||
raidCommand, | ||
{ | ||
cox: { | ||
start: { | ||
type: 'fakemass', | ||
max_team_size: 5 | ||
} | ||
} | ||
}, | ||
true | ||
); | ||
expect(res).toContain('the total trip will take'); | ||
await user.processActivities(client); | ||
await user.sync(); | ||
expect(user.bank.amount('Scythe of vitur (uncharged)')).toBe(1); | ||
expect(user.bank.amount('Scythe of vitur')).toBe(0); | ||
expect(user.gear.melee.weapon?.item).toBeUndefined(); | ||
expect(user.allItemsOwned.amount('Scythe of vitur (uncharged)')).toBe(1); | ||
expect(user.allItemsOwned.amount('Scythe of vitur')).toBe(0); | ||
}); |