Skip to content

Commit

Permalink
changes
Browse files Browse the repository at this point in the history
  • Loading branch information
gc committed Nov 15, 2024
1 parent e8224ff commit bf74b85
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 10 deletions.
1 change: 0 additions & 1 deletion src/mahoji/commands/clue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,6 @@ export const clueCommand: OSBMahojiCommand = {
} from ${openedImplings}x ${clueImpling.name}s.`;
}

console.log({ timeToFinish: formatDuration(timeToFinish), duration: formatDuration(duration), quantity });
duration = timeToFinish * quantity;

await addSubTaskToActivityTask<ClueActivityTaskOptions>({
Expand Down
39 changes: 39 additions & 0 deletions tests/integration/clueJuggling.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import { EItem, EMonster } from 'oldschooljs';
import { describe, expect, it } from 'vitest';

import { clueCommand } from '../../src/mahoji/commands/clue';
import { createTestUser } from './util';

describe('Clue Juggling', async () => {
it('general test', async () => {
const user = await createTestUser();
await user.equip('melee', [
EItem.PRIMORDIAL_BOOTS,
EItem.INFERNAL_MAX_CAPE,
EItem.FEROCIOUS_GLOVES,
EItem.AMULET_OF_TORTURE,
EItem.INQUISITORS_MACE,
EItem.INQUISITORS_HAUBERK,
EItem.INQUISITORS_PLATESKIRT
]);
expect(user.bank.amount(EItem.CLUE_SCROLL_BEGINNER)).toBe(0);
expect(user.bank.amount(EItem.CLUE_SCROLL_EASY)).toBe(0);
await user.kill(EMonster.MAN);

expect(user.bank.amount(EItem.CLUE_SCROLL_BEGINNER)).toEqual(0);
expect(user.bank.amount(EItem.CLUE_SCROLL_EASY)).toEqual(0);

const droppedClues = await prisma.droppedClueScroll.findMany({
where: {
user_id: user.id
}
});
expect(droppedClues.length).toBeGreaterThan(0);
const cmdResult = await user.runCommand(clueCommand, {
tier: 'beginner'
});
expect(cmdResult).toContain('is now completing ');
expect(cmdResult).not.toContain('is now completing 1x');
expect(user.bank.amount(EItem.CLUE_SCROLL_BEGINNER)).toEqual(0);
});
});
9 changes: 0 additions & 9 deletions tests/unit/util.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { Bank, convertLVLtoXP } from 'oldschooljs';
import { describe, expect, test } from 'vitest';

import { baseModifyBusyCounter } from '../../src/lib/busyCounterCache';
import { deduplicateClueScrolls } from '../../src/lib/clues/clueUtils';
import getUserFoodFromBank from '../../src/lib/minions/functions/getUserFoodFromBank';
import { SkillsEnum } from '../../src/lib/skilling/types';
import { pluraliseItemName, skillingPetDropRate } from '../../src/lib/util';
Expand Down Expand Up @@ -59,14 +58,6 @@ describe('util', () => {
).toStrictEqual(new Bank().add('Lobster', 20).add('Shark', 66).add('Shrimps', 50));
});

test('deduplicateClueScrolls', () => {
const currentBank = new Bank().add('Clue scroll(easy)');
const loot = new Bank().add('Clue scroll(easy)').add('Clue scroll(hard)', 10).add('Clue scroll(master)');
expect(deduplicateClueScrolls({ loot, currentBank }).toJSON()).toEqual(
new Bank().add('Clue scroll(hard)').add('Clue scroll(master)').toJSON()
);
});

test('truncateString', () => {
expect(truncateString('testtttttt', 5)).toEqual('te...');
});
Expand Down

0 comments on commit bf74b85

Please sign in to comment.