Skip to content

Commit

Permalink
test fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
gc committed Feb 27, 2024
1 parent f9db368 commit 1515277
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions tests/integration/commands/sacrifice.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,21 @@ describe('Sacrifice Command', async () => {

test('No items provided', async () => {
const result = await user.runCommand(sacrificeCommand, { items: 'aaaa' });
expect(result).toEqual('No items were provided.\nYour current sacrificed value is: 1,922 (1.92k)');
expect(result).toEqual('No items were provided.\nYour current sacrificed value is: 1,909 (1.91k)');
});

test('Successful', async () => {
await user.addItemsToBank({ items: new Bank().add('Trout').add('Coal', 10) });
const result = await user.runCommand(sacrificeCommand, { items: '1 trout, 10 coal' });
expect(result).toEqual(
'You sacrificed 10x Coal, 1x Trout, with a value of 1,922gp (1.92k). Your total amount sacrificed is now: 3,844. '
'You sacrificed 10x Coal, 1x Trout, with a value of 1,909gp (1.91k). Your total amount sacrificed is now: 3,818. '
);
const stats = await user.fetchStats({ sacrificed_bank: true });
expect(user.bank.equals(new Bank())).toBe(true);
expect(new Bank(stats.sacrificed_bank as ItemBank).equals(new Bank().add('Coal', 20).add('Trout', 2))).toBe(
true
);
expect(user.user.sacrificedValue).toEqual(BigInt(3844));
expect(user.user.sacrificedValue).toEqual(BigInt(3818));
const clientSettings = await mahojiClientSettingsFetch({ economyStats_sacrificedBank: true });
expect(
new Bank(clientSettings.economyStats_sacrificedBank as ItemBank).equals(
Expand All @@ -49,15 +49,15 @@ describe('Sacrifice Command', async () => {
await user.addItemsToBank({ items: new Bank().add('Trout').add('Cake') });
const res = await user.runCommand(sacrificeCommand, { items: '1 trout, 1 cake' });
expect(res).toEqual(
'You sacrificed 1x Trout, 1x Cake, with a value of 169gp (169). Your total amount sacrificed is now: 4,013. '
'You sacrificed 1x Trout, 1x Cake, with a value of 156gp (156). Your total amount sacrificed is now: 3,974. '
);
await user.sync();
expect(user.bank.equals(new Bank())).toBe(true);
const stats2 = await user.fetchStats({ sacrificed_bank: true });
expect(
new Bank(stats2.sacrificed_bank as ItemBank).equals(new Bank().add('Coal', 20).add('Trout', 3).add('Cake'))
).toBe(true);
expect(user.user.sacrificedValue).toEqual(BigInt(4013));
expect(user.user.sacrificedValue).toEqual(BigInt(3974));

const clientSettings2 = await mahojiClientSettingsFetch({ economyStats_sacrificedBank: true });
expect(
Expand Down

0 comments on commit 1515277

Please sign in to comment.