Skip to content

Commit 6507a2b

Browse files
committed
Moved method call to inside arrow function to preserve "this" context
1 parent 9f93940 commit 6507a2b

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

day-02-dive.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { commands } from './day-02-dive.input';
44
describe('Day 2 - Dive', () => {
55
test('should throw Error for unknown commands', () => {
66
const measurer = new DiverCommandsInterpreter([['unknown', 1]]);
7-
expect(measurer.computeOffsetFromCommands).toThrowError();
7+
expect(() => measurer.computeOffsetFromCommands()).toThrowError();
88
});
99
test('should return [0, 0] for no commands', () => {
1010
const measurer = new DiverCommandsInterpreter([]);

day-03-binary-diagnostic.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
import DiagnosticReportCalculator from './day-03-binary-diagnostic';
1+
import { DiagnosticReportCalculator } from './day-03-binary-diagnostic';
22
import { binaryNumbers } from './day-03-binary-diagnostic.input';
33

44
describe('Day 3 - Binary Diagnostic', () => {
55
test('should throw Error for empty readings', () => {
66
const calculator = new DiagnosticReportCalculator([]);
7-
expect(calculator.computeEpsilonAndGamma).toThrowError();
7+
expect(() => calculator.computeEpsilonAndGamma()).toThrowError();
88
});
99
test('should throw Error for inconsistent reading lengths', () => {
10-
const calculator = new DiagnosticReportCalculator(['1', '11']);
11-
expect(calculator.computeEpsilonAndGamma).toThrowError();
10+
const calculator = new DiagnosticReportCalculator(['1', '01']);
11+
expect(() => calculator.computeEpsilonAndGamma()).toThrowError();
1212
});
1313
test('should return 2743844 for puzzle part 1 answer', () => {
1414
const calculator = new DiagnosticReportCalculator(binaryNumbers);

0 commit comments

Comments
 (0)