@quenty/elo 7.18.2 → 7.19.0-canary.544.de8fcee.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,9 +3,13 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
- ## [7.18.2](https://github.com/Quenty/NevermoreEngine/compare/@quenty/elo@7.18.1...@quenty/elo@7.18.2) (2025-03-31)
6
+ # [7.19.0-canary.544.de8fcee.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/elo@7.18.1...@quenty/elo@7.19.0-canary.544.de8fcee.0) (2025-04-01)
7
7
 
8
- **Note:** Version bump only for package @quenty/elo
8
+
9
+ ### Bug Fixes
10
+
11
+ * Fix existing tests ([655787c](https://github.com/Quenty/NevermoreEngine/commit/655787ced1139136e12f81800e229aa076731561))
12
+ * Fix percentile test ([3f5a3e1](https://github.com/Quenty/NevermoreEngine/commit/3f5a3e1713068da6783bfc06634e3d793ccd4030))
9
13
 
10
14
 
11
15
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quenty/elo",
3
- "version": "7.18.2",
3
+ "version": "7.19.0-canary.544.de8fcee.0",
4
4
  "description": "Elo rating utility library.",
5
5
  "keywords": [
6
6
  "Roblox",
@@ -29,12 +29,12 @@
29
29
  "access": "public"
30
30
  },
31
31
  "devDependencies": {
32
- "@quenty/blend": "^12.17.2",
33
- "@quenty/loader": "^10.8.0",
34
- "@quenty/maid": "^3.4.0"
32
+ "@quenty/blend": "12.18.0-canary.544.de8fcee.0",
33
+ "@quenty/loader": "10.8.0",
34
+ "@quenty/maid": "3.4.0"
35
35
  },
36
36
  "dependencies": {
37
- "@quenty/probability": "^2.3.1"
37
+ "@quenty/probability": "2.3.1"
38
38
  },
39
- "gitHead": "af926ec08f523833f37d22477c72dca034219823"
39
+ "gitHead": "de8fcee995fcdae464964357b4c770c03f4c7e03"
40
40
  }
@@ -3,72 +3,78 @@
3
3
  @class EloUtils.spec.lua
4
4
  ]]
5
5
 
6
- local EloUtils = require(script.Parent.EloUtils)
7
-
8
- return function()
9
- describe("EloUtils.getNewElo", function()
10
- local config = EloUtils.createConfig()
11
-
12
- local playerRating = 1400
13
- local opponentRating = 1800
14
-
15
- local newPlayerWinRating, newOpponentWinRating
16
- local newPlayerLossRating, newOpponentLossRating
17
- local newPlayerDrawRating, newOpponentDrawRating
18
-
19
- it("should change on win", function()
20
- newPlayerWinRating, newOpponentWinRating = EloUtils.getNewElo(
21
- config,
22
- playerRating,
23
- opponentRating,
24
- {
25
- EloUtils.MatchResult.PLAYER_ONE_WIN;
26
- })
27
-
28
- expect(newPlayerWinRating > playerRating).to.equal(true)
29
- expect(newOpponentWinRating < opponentRating).to.equal(true)
30
- end)
31
-
32
- it("should change on a loss", function()
33
- newPlayerLossRating, newOpponentLossRating = EloUtils.getNewElo(
34
- config,
35
- playerRating,
36
- opponentRating,
37
- {
38
- EloUtils.MatchResult.PLAYER_TWO_WIN;
39
- })
40
-
41
- expect(newPlayerLossRating < playerRating).to.equal(true)
42
- expect(newOpponentLossRating > opponentRating).to.equal(true)
43
- end)
44
-
45
- it("should change on a draw", function()
46
- newPlayerDrawRating, newOpponentDrawRating = EloUtils.getNewElo(
47
- config,
48
- playerRating,
49
- opponentRating,
50
- {
51
- EloUtils.MatchResult.DRAW;
52
- })
53
-
54
- expect(newPlayerDrawRating > playerRating).to.equal(true)
55
- expect(newOpponentDrawRating < opponentRating).to.equal(true)
56
- end)
57
-
58
- it("should change more on an unexpected win then a loss", function()
59
- local winChange = math.abs(playerRating - newPlayerWinRating)
60
- local drawChange = math.abs(playerRating - newPlayerDrawRating)
61
- local lossChange = math.abs(playerRating - newPlayerLossRating)
62
-
63
- expect(winChange > lossChange).to.equal(true)
64
- expect(winChange > drawChange ).to.equal(true)
65
- expect(drawChange > lossChange).to.equal(true)
66
- end)
67
-
68
- it("should compute percentile as 0.5", function()
69
- local percentile = EloUtils.getPercentile(config, 1400)
70
-
71
- expect(percentile).to.equal(0.5)
72
- end)
6
+ local require = require(game:GetService("ServerScriptService"):FindFirstChild("LoaderUtils", true).Parent).bootstrapStory(script)
7
+
8
+ local EloMatchResult = require("EloMatchResult")
9
+ local EloUtils = require("EloUtils")
10
+ local Jest = require("Jest")
11
+
12
+ local describe = Jest.Globals.describe
13
+ local expect = Jest.Globals.expect
14
+ local it = Jest.Globals.it
15
+
16
+ describe("EloUtils.getNewElo", function()
17
+ local config = EloUtils.createConfig()
18
+
19
+ local playerRating = 1400
20
+ local opponentRating = 1800
21
+
22
+ local newPlayerWinRating, newOpponentWinRating
23
+ local newPlayerLossRating, newOpponentLossRating
24
+ local newPlayerDrawRating, newOpponentDrawRating
25
+
26
+ it("should change on win", function()
27
+ newPlayerWinRating, newOpponentWinRating = EloUtils.getNewElo(
28
+ config,
29
+ playerRating,
30
+ opponentRating,
31
+ {
32
+ EloMatchResult.PLAYER_ONE_WIN;
33
+ })
34
+
35
+ expect(newPlayerWinRating > playerRating).toBe(true)
36
+ expect(newOpponentWinRating < opponentRating).toBe(true)
37
+ end)
38
+
39
+ it("should change on a loss", function()
40
+ newPlayerLossRating, newOpponentLossRating = EloUtils.getNewElo(
41
+ config,
42
+ playerRating,
43
+ opponentRating,
44
+ {
45
+ EloMatchResult.PLAYER_TWO_WIN;
46
+ })
47
+
48
+ expect(newPlayerLossRating < playerRating).toBe(true)
49
+ expect(newOpponentLossRating > opponentRating).toBe(true)
50
+ end)
51
+
52
+ it("should change on a draw", function()
53
+ newPlayerDrawRating, newOpponentDrawRating = EloUtils.getNewElo(
54
+ config,
55
+ playerRating,
56
+ opponentRating,
57
+ {
58
+ EloMatchResult.DRAW;
59
+ })
60
+
61
+ expect(newPlayerDrawRating > playerRating).toBe(true)
62
+ expect(newOpponentDrawRating < opponentRating).toBe(true)
63
+ end)
64
+
65
+ it("should change more on an unexpected win then a loss", function()
66
+ local winChange = math.abs(playerRating - newPlayerWinRating)
67
+ local drawChange = math.abs(playerRating - newPlayerDrawRating)
68
+ local lossChange = math.abs(playerRating - newPlayerLossRating)
69
+
70
+ expect(winChange > lossChange).toBe(true)
71
+ expect(winChange > drawChange ).toBe(true)
72
+ expect(drawChange > lossChange).toBe(true)
73
+ end)
74
+
75
+ it("should compute percentile as 0.5", function()
76
+ local percentile = EloUtils.getPercentile(config, 1400)
77
+
78
+ expect(percentile).toBeCloseTo(0.5, 5)
73
79
  end)
74
- end
80
+ end)