Skip to content

Commit

Permalink
format with newer version of prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
FinnIckler committed Feb 19, 2024
1 parent f8d13fa commit f20271c
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 24 deletions.
4 changes: 2 additions & 2 deletions spec/activity.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ describe('Activity Helper', function () {
describe('activityCodeToName', function () {
it('Produces a readable representation of an activity code', function () {
expect(activityCodeToName('444-r2-g5')).toEqual(
'4x4x4 Cube, Round 2, Group 5'
'4x4x4 Cube, Round 2, Group 5',
);
expect(activityCodeToName('clock')).toEqual('Clock');
expect(activityCodeToName('333fm-r1-a2')).toEqual(
'3x3x3 Fewest Moves, Round 1, Attempt 2'
'3x3x3 Fewest Moves, Round 1, Attempt 2',
);
});
});
Expand Down
2 changes: 1 addition & 1 deletion spec/ranking.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ function createResult(personId: number, plain: number[]): Result {
r.attempts.push({
result: p,
reconstruction: null,
})
}),
);
return r;
}
Expand Down
24 changes: 12 additions & 12 deletions spec/result.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,15 @@ describe('Result helper', function () {

it('Correctly identifies if MBLD result should be a DNF', function () {
expect(
isMultiResultDnf({ solved: 1, attempted: 2, centiseconds: 10000 })
isMultiResultDnf({ solved: 1, attempted: 2, centiseconds: 10000 }),
).toBeTruthy();
expect(
isMultiResultDnf({ solved: 2, attempted: 5, centiseconds: 10000 })
isMultiResultDnf({ solved: 2, attempted: 5, centiseconds: 10000 }),
).toBeTruthy();
expect(isMultiResultDnf({ isDnf: true })).toBeTruthy();
expect(isMultiResultDnf({ isDns: true })).toBeTruthy();
expect(
isMultiResultDnf({ solved: 3, attempted: 5, centiseconds: 10000 })
isMultiResultDnf({ solved: 3, attempted: 5, centiseconds: 10000 }),
).toBeFalsy();
});

Expand All @@ -89,17 +89,17 @@ describe('Result helper', function () {
solved: 4,
attempted: 6,
centiseconds: 360000,
})
}),
).toEqual(970360002);
});

it('Correctly encodes MBLD result as DNF', function () {
expect(encodeMultiResult({ isDnf: true })).toEqual(-1);
expect(
encodeMultiResult({ solved: 1, attempted: 2, centiseconds: 10000 })
encodeMultiResult({ solved: 1, attempted: 2, centiseconds: 10000 }),
).toEqual(-1);
expect(
encodeMultiResult({ solved: 2, attempted: 5, centiseconds: 10000 })
encodeMultiResult({ solved: 2, attempted: 5, centiseconds: 10000 }),
).toEqual(-1);
});

Expand All @@ -112,31 +112,31 @@ describe('Result helper', function () {
encodeMultiResult({
solved: 4,
attempted: 6,
})
}),
).toEqual(979999902);
});

it('Correctly formats a MBLD result', function () {
expect(
formatMultiResult({ solved: 3, attempted: 5, centiseconds: 10000 })
formatMultiResult({ solved: 3, attempted: 5, centiseconds: 10000 }),
).toEqual('3/5 1:40');
expect(
formatMultiResult({ solved: 3, attempted: 5, centiseconds: 10001 })
formatMultiResult({ solved: 3, attempted: 5, centiseconds: 10001 }),
).toEqual('3/5 1:40');
expect(
formatMultiResult({ solved: 25, attempted: 25, centiseconds: 360000 })
formatMultiResult({ solved: 25, attempted: 25, centiseconds: 360000 }),
).toEqual('25/25 60:00');
expect(formatMultiResult({ isDnf: true })).toEqual('DNF');
expect(formatMultiResult({ isDns: true })).toEqual('DNS');
expect(
formatMultiResult({ solved: 2, attempted: 5, centiseconds: 10000 })
formatMultiResult({ solved: 2, attempted: 5, centiseconds: 10000 }),
).toEqual('DNF');
});

it('Correctly formats a MBLD result with unknown time', function () {
expect(formatMultiResult({ solved: 3, attempted: 5 })).toEqual('3/5');
expect(
formatMultiResult({ solved: 3, attempted: 5, centiseconds: 9999900 })
formatMultiResult({ solved: 3, attempted: 5, centiseconds: 9999900 }),
).toEqual('3/5');
});

Expand Down
2 changes: 1 addition & 1 deletion spec/support/utils.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export default function testCases(
this: any,
values: any[],
func: (value: any) => void
func: (value: any) => void,
) {
for (let i = 0, count = values.length; i < count; i++) {
func.apply(this, [values[i]]);
Expand Down
2 changes: 1 addition & 1 deletion src/helpers/activity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export interface ParsedActivityCode {

export function parseActivityCode(activityCode: string): ParsedActivityCode {
const [, e, r, g, a] = activityCode.match(
/^(\w+)(?:-r(\d+))?(?:-g(\d+))?(?:-a(\d+))?$/
/^(\w+)(?:-r(\d+))?(?:-g(\d+))?(?:-a(\d+))?$/,
) as any[];
return {
eventId: e,
Expand Down
8 changes: 4 additions & 4 deletions src/helpers/average.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ export function Ao5(results: AttemptResult[]): AttemptResult | null {
let avg = Math.round(
(comparableResults.reduce(
(a, b) => parseInt(`${a}`, 10) + parseInt(`${b}`, 10),
0
) as number) / 3
0,
) as number) / 3,
);
if (avg > 60000) {
avg = Math.round(avg / 100) * 100;
Expand All @@ -53,8 +53,8 @@ export function Mo3(results: AttemptResult[]): AttemptResult | null {
let avg = Math.round(
(results.reduce(
(a, b) => parseInt(`${a}`, 10) + parseInt(`${b}`, 10),
0
) as number) / 3
0,
) as number) / 3,
);
if (avg > 60000) {
avg = Math.round(avg / 100) * 100;
Expand Down
2 changes: 1 addition & 1 deletion src/helpers/event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export function getEventName(eventId: EventId): string {
}

export function getEventResultType(
eventId: EventId
eventId: EventId,
): 'time' | 'number' | 'multi' {
return eventDataById[eventId].resultType;
}
4 changes: 2 additions & 2 deletions src/helpers/result.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,13 @@ export function formatMultiResult(result: DecodedMultiResult): string {
}

function isDnfMultiResult(
result: DecodedMultiResult
result: DecodedMultiResult,
): result is DnfMultiResult {
return result.hasOwnProperty('isDnf');
}

function isDnsMultiResult(
result: DecodedMultiResult
result: DecodedMultiResult,
): result is DnsMultiResult {
return result.hasOwnProperty('isDns');
}
Expand Down

0 comments on commit f20271c

Please sign in to comment.