util: add isLimitedJob helper function#1023
util: add isLimitedJob helper function#1023Bing-su wants to merge 2 commits intoOverlayPlugin:mainfrom
Conversation
Adds a helper to identify limited jobs (currently BLU) and its unit tests.
There was a problem hiding this comment.
Pull request overview
This PR adds a helper function isLimitedJob to resources/util.ts, which identifies limited jobs (currently only BLU / Blue Mage) using a dedicated limitedJobs array. The PR also includes unit tests for this new helper. It is described as preparatory work ahead of the Beastmaster job release.
Changes:
- Adds a
limitedJobsarray andisLimitedJobhelper function toresources/util.ts, consistent with existing job classification helpers. - Adds a unit test for
isLimitedJobintest/unittests/util_test.ts, verifying BLU returnstrueand all other tested jobs returnfalse.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
resources/util.ts |
Adds limitedJobs constant array and isLimitedJob method to the Util object |
test/unittests/util_test.ts |
Adds a test case asserting limited jobs are correctly identified by Util.isLimitedJob |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
test/unittests/util_test.ts
Outdated
There was a problem hiding this comment.
| const healerJobs: Job[] = ['CNJ', 'WHM', 'SCH', 'AST', 'SGE']; | |
| const meleeDpsJobs: Job[] = ['PGL', 'MNK', 'LNC', 'DRG', 'ROG', 'NIN', 'SAM', 'RPR', 'VPR']; |
test/unittests/util_test.ts
Outdated
There was a problem hiding this comment.
| const casterDpsJobs: Job[] = ['BLU', 'RDM', 'BLM', 'SMN', 'ACN', 'THM', 'PCT']; |
test/unittests/util_test.ts
Outdated
| ); | ||
| }); | ||
| it('jobs should be set as limited jobs correctly', () => { | ||
| const limitedJobs: Job[] = ['BLU']; |
There was a problem hiding this comment.
I'd prefer if we kept all the job constants together so they are easier to find/update; we're already doing a poor job of keeping this file up-to-date with new jobs as evidenced by SGE, RPR, VPR, and PCT being missing.
There was a problem hiding this comment.
I think it would be better to export the consts from util.ts for reuse.
Expose per-category job arrays (allJobs, tankJobs, healerJobs, meleeDpsJobs, rangedDpsJobs, casterDpsJobs, dpsJobs, craftingJobs, gatheringJobs, limitedJobs) so they can be reused across the codebase and tests. Update tests to import and rely on these exports instead of duplicating definitions, ensuring consistent references for isLimitedJob tests and related utilities.
Adds a helper to identify limited jobs (currently BLU) and its unit tests.
I think it would be helpful to add this before the Beastmaster release.