-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(endpoint): endpoint update (#583)
* feat(endpoints): update endpoints * feat(utils): added a regionToCluster util method
- Loading branch information
1 parent
fb79e79
commit 43fda71
Showing
6 changed files
with
329 additions
and
560 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,35 @@ | ||
import { PlatformId } from "@fightmegg/riot-rate-limiter"; | ||
import { regionToCluster } from "../../src/utils"; | ||
|
||
describe("utils", () => { | ||
beforeEach(() => { | ||
jest.clearAllMocks(); | ||
}); | ||
|
||
describe("regionToCluster", () => { | ||
test("should return correct cluster for each region", () => { | ||
expect(regionToCluster(PlatformId.NA1)).toEqual(PlatformId.AMERICAS); | ||
expect(regionToCluster(PlatformId.BR1)).toEqual(PlatformId.AMERICAS); | ||
expect(regionToCluster(PlatformId.LA1)).toEqual(PlatformId.AMERICAS); | ||
expect(regionToCluster(PlatformId.LA2)).toEqual(PlatformId.AMERICAS); | ||
|
||
expect(regionToCluster(PlatformId.KR)).toEqual(PlatformId.ASIA); | ||
expect(regionToCluster(PlatformId.JP1)).toEqual(PlatformId.ASIA); | ||
|
||
expect(regionToCluster(PlatformId.EUW1)).toEqual(PlatformId.EUROPE); | ||
expect(regionToCluster(PlatformId.EUNE1)).toEqual(PlatformId.EUROPE); | ||
expect(regionToCluster(PlatformId.TR1)).toEqual(PlatformId.EUROPE); | ||
expect(regionToCluster(PlatformId.RU)).toEqual(PlatformId.EUROPE); | ||
|
||
expect(regionToCluster(PlatformId.OC1)).toEqual(PlatformId.SEA); | ||
expect(regionToCluster(PlatformId.PH2)).toEqual(PlatformId.SEA); | ||
expect(regionToCluster(PlatformId.SG2)).toEqual(PlatformId.SEA); | ||
expect(regionToCluster(PlatformId.TH2)).toEqual(PlatformId.SEA); | ||
expect(regionToCluster(PlatformId.TW2)).toEqual(PlatformId.SEA); | ||
expect(regionToCluster(PlatformId.VN2)).toEqual(PlatformId.SEA); | ||
|
||
// @ts-expect-error -- testing invalid input | ||
expect(regionToCluster("invalid")).toEqual(PlatformId.AMERICAS); | ||
}); | ||
}); | ||
}); |
Oops, something went wrong.