Skip to content

Commit

Permalink
yarn lint changes
Browse files Browse the repository at this point in the history
  • Loading branch information
SameerDalal committed Nov 26, 2024
1 parent f1a3f12 commit c13ab6d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
14 changes: 8 additions & 6 deletions packages/server/src/rating/__tests__/rating.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ import {
getGlickoResult,
} from "../rating";
import { Glicko2 } from "glicko2";
import { UserRanking, UserRankings, UserResponse } from "@ogfcommunity/variants-shared";
import {
UserRanking,
UserRankings,
UserResponse,
} from "@ogfcommunity/variants-shared";

test("supportsRatings", () => {
const supportsRating = supportsRatings("chess");
Expand All @@ -16,12 +20,11 @@ test("supportsRatings", () => {
});

test("getGlickoPlayer - with typical player value", () => {

const db_player_ranking_quantum = {
rating: 1337,
rd: 290,
vol: 0.0599,
}
};

const ranking = new Glicko2({
tau: 0.5,
Expand All @@ -47,14 +50,13 @@ test("getGlickoPlayer - when player does not have any rating", () => {
vol: 0.06,
});

const player = getGlickoPlayer(db_player_ranking_quantum, ranking)
const player = getGlickoPlayer(db_player_ranking_quantum, ranking);

expect(player.getRating()).toBe(1500);
expect(player.getRd()).toBe(350);
expect(player.getVol()).toBe(0.06);
});


test("getGlickoResult", () => {
expect(getGlickoResult("B")).toBe(1);
expect(getGlickoResult("W")).toBe(0);
Expand Down Expand Up @@ -116,7 +118,7 @@ test("applyPlayerRankingToUserResponse", () => {
rd: 290,
vol: 0.0599,
},
}
};

expect(
applyPlayerRankingToUserResponse(db_player_initial, glicko_player, variant),
Expand Down
4 changes: 2 additions & 2 deletions packages/server/src/rating/rating.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ export async function updateRatings(
ranking,
);

ranking.addResult(glicko_player_black, glicko_player_white, glicko_outcome)
ranking.addResult(glicko_player_black, glicko_player_white, glicko_outcome);

ranking.calculatePlayersRatings()
ranking.calculatePlayersRatings();

const player_black_new_ranking = applyPlayerRankingToUserResponse(
db_player_black,
Expand Down

0 comments on commit c13ab6d

Please sign in to comment.