From 2e3973600c178a5d500e9120245936839d54b1fa Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 10 May 2024 07:31:16 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- .../HelperFunctions/CalculateLuckyLevels.js | 8 +++--- .../Statistics/CreateStatsSections.js | 18 +++++++------ test/t_Disp/t_CalculateLuckyLevels.js | 25 ++++++++++++++----- 3 files changed, 33 insertions(+), 18 deletions(-) diff --git a/src/Disp/HelperFunctions/CalculateLuckyLevels.js b/src/Disp/HelperFunctions/CalculateLuckyLevels.js index 04a6fb9e..596738f4 100644 --- a/src/Disp/HelperFunctions/CalculateLuckyLevels.js +++ b/src/Disp/HelperFunctions/CalculateLuckyLevels.js @@ -49,7 +49,7 @@ export default function CalculateLuckyLevels(currentLevel) { // Consider only top 15 digits if it is big number let localLevel; if (numberOfDigits >= 16) { - localLevel = Math.ceil(currentLevel / (10 ** (numberOfDigits - 15))); + localLevel = Math.ceil(currentLevel / 10 ** (numberOfDigits - 15)); } else { localLevel = currentLevel; } @@ -65,7 +65,7 @@ export default function CalculateLuckyLevels(currentLevel) { result.luckyDigit = localLevel; if (numberOfDigits >= 16) { - result.luckyDigit *= 10 ** Number((numberOfDigits - 15)); + result.luckyDigit *= 10 ** Number(numberOfDigits - 15); } } @@ -80,7 +80,7 @@ export default function CalculateLuckyLevels(currentLevel) { result.luckyNumber = localLevel; if (numberOfDigits >= 16) { - result.luckyNumber *= 10 ** Number((numberOfDigits - 15)); + result.luckyNumber *= 10 ** Number(numberOfDigits - 15); } } @@ -97,7 +97,7 @@ export default function CalculateLuckyLevels(currentLevel) { result.luckyPayout = localLevel; if (numberOfDigits >= 16) { - result.luckyPayout *= 10 ** Number((numberOfDigits - 15)); + result.luckyPayout *= 10 ** Number(numberOfDigits - 15); } return result; diff --git a/src/Disp/MenuSections/Statistics/CreateStatsSections.js b/src/Disp/MenuSections/Statistics/CreateStatsSections.js index 7423f3a4..63bc2df8 100644 --- a/src/Disp/MenuSections/Statistics/CreateStatsSections.js +++ b/src/Disp/MenuSections/Statistics/CreateStatsSections.js @@ -607,11 +607,7 @@ export function PrestigeSection() { const currentPrestige = Math.floor(Game.HowMuchPrestige(Game.cookiesReset)); const willHave = Math.floor(Game.HowMuchPrestige(Game.cookiesReset + Game.cookiesEarned)); const willGet = willHave - currentPrestige; - const { - luckyDigit, - luckyNumber, - luckyPayout - } = CalculateLuckyLevels(willHave); + const { luckyDigit, luckyNumber, luckyPayout } = CalculateLuckyLevels(willHave); if (!Game.Has('Lucky digit')) { const luckyDigitDelta = luckyDigit - willHave; const luckyDigitReset = willGet + luckyDigitDelta; @@ -621,7 +617,9 @@ export function PrestigeSection() { `${luckyDigit.toLocaleString()} / ${luckyDigitReset.toLocaleString()} (+${luckyDigitDelta})`, ), ); - section.appendChild(StatsListing('basic', 'Next "Lucky Digit" (total / reset)', fragLuckyDigit)); + section.appendChild( + StatsListing('basic', 'Next "Lucky Digit" (total / reset)', fragLuckyDigit), + ); } if (!Game.Has('Lucky number')) { @@ -633,7 +631,9 @@ export function PrestigeSection() { `${luckyNumber.toLocaleString()} / ${luckyNumberReset.toLocaleString()} (+${luckyNumberDelta})`, ), ); - section.appendChild(StatsListing('basic', 'Next "Lucky Number" (total / reset)', fragLuckyNumber)); + section.appendChild( + StatsListing('basic', 'Next "Lucky Number" (total / reset)', fragLuckyNumber), + ); } if (!Game.Has('Lucky payout')) { @@ -645,7 +645,9 @@ export function PrestigeSection() { `${luckyPayout.toLocaleString()} / ${luckyPayoutReset.toLocaleString()} (+${luckyPayoutDelta})`, ), ); - section.appendChild(StatsListing('basic', 'Next "Lucky Payout" (total / reset)', fragLuckyPayout)); + section.appendChild( + StatsListing('basic', 'Next "Lucky Payout" (total / reset)', fragLuckyPayout), + ); } return section; diff --git a/test/t_Disp/t_CalculateLuckyLevels.js b/test/t_Disp/t_CalculateLuckyLevels.js index 5e949292..da5672d9 100644 --- a/test/t_Disp/t_CalculateLuckyLevels.js +++ b/test/t_Disp/t_CalculateLuckyLevels.js @@ -1,20 +1,23 @@ import { describe, it } from 'mocha'; import { expect } from 'chai'; -import CalculateLuckyLevels, { CalculateSevenDelta, CountSevens } from '../../src/Disp/HelperFunctions/CalculateLuckyLevels'; +import CalculateLuckyLevels, { + CalculateSevenDelta, + CountSevens, +} from '../../src/Disp/HelperFunctions/CalculateLuckyLevels'; describe('CountSevens', () => { const examples = [ { input: 1234567890, output: 1 }, { input: 7777777777, output: 10 }, { input: 1111111111, output: 0 }, - { input: 7897897897, output: 4 } + { input: 7897897897, output: 4 }, ]; examples.forEach((example) => { it(`Counts sevens in ${example.input}`, () => { expect(CountSevens(example.input)).to.equal(example.output); - }) + }); }); }); @@ -48,8 +51,18 @@ describe('CalculateLuckyLevels', () => { { input: 77777, luckyDigit: 77777, luckyNumber: 77777, luckyPayout: 77777 }, { input: 799999, luckyDigit: 799999, luckyNumber: 800077, luckyPayout: 807777 }, { input: 999999, luckyDigit: 1000007, luckyNumber: 1000077, luckyPayout: 1007777 }, - { input: 123456789123456789, luckyDigit: 123456789123456789, luckyNumber: 123456789123456789, luckyPayout: 123456789123777000 }, - { input: 8888888888888888888, luckyDigit: 8888888888888970000, luckyNumber: 8888888888889770000, luckyPayout: 8888888888977770000 }, + { + input: 123456789123456789, + luckyDigit: 123456789123456789, + luckyNumber: 123456789123456789, + luckyPayout: 123456789123777000, + }, + { + input: 8888888888888888888, + luckyDigit: 8888888888888970000, + luckyNumber: 8888888888889770000, + luckyPayout: 8888888888977770000, + }, ]; examples.forEach((example) => { @@ -57,7 +70,7 @@ describe('CalculateLuckyLevels', () => { expect(CalculateLuckyLevels(example.input)).to.deep.equal({ luckyDigit: example.luckyDigit, luckyNumber: example.luckyNumber, - luckyPayout: example.luckyPayout + luckyPayout: example.luckyPayout, }); }); });