|
1 | 1 | import { describe, it, expect } from "bun:test";
|
2 |
| -import { findDistance } from "./day-01-historian-hysteria"; |
| 2 | +import { findDistance, findDistancePart_2 } from "./day-01-historian-hysteria"; |
| 3 | + |
| 4 | +const fileTest = Bun.file("./src/day-01-historian-hysteria-input.test.txt"); |
| 5 | +const contentTest = await fileTest.text(); |
3 | 6 |
|
4 | 7 | const file = Bun.file("./src/day-01-historian-hysteria-input.txt");
|
5 | 8 | const content = await file.text();
|
6 | 9 |
|
7 |
| -describe("Day 1: Historian Hysteria", async () => { |
8 |
| - it("should return the correct distance", () => { |
9 |
| - const result = findDistance(content); |
10 |
| - const expected = 11; |
11 |
| - expect(result).toBe(expected); |
12 |
| - expect(typeof content).toBe("string"); |
| 10 | +describe("Day 1: Historian Hysteria", () => { |
| 11 | + describe("part 1", () => { |
| 12 | + it("should return the correct distance with test file", () => { |
| 13 | + const result = findDistance(contentTest); |
| 14 | + const expected = 11; |
| 15 | + expect(result).toBe(expected); |
| 16 | + expect(typeof content).toBe("string"); |
| 17 | + }); |
| 18 | + it("should return the correct distance with real file", () => { |
| 19 | + const result = findDistance(content); |
| 20 | + const expected = 2192892; |
| 21 | + expect(result).toBe(expected); |
| 22 | + expect(typeof content).toBe("string"); |
| 23 | + }); |
| 24 | + }); |
| 25 | + describe("part 2", () => { |
| 26 | + it("should return the correct distance with test file", () => { |
| 27 | + const result = findDistancePart_2(contentTest); |
| 28 | + const expected = 31; |
| 29 | + expect(result).toBe(expected); |
| 30 | + expect(typeof content).toBe("string"); |
| 31 | + }); |
| 32 | + it("should return the correct distance", () => { |
| 33 | + const result = findDistancePart_2(content); |
| 34 | + const expected = 22962826; |
| 35 | + expect(result).toBe(expected); |
| 36 | + expect(typeof content).toBe("string"); |
| 37 | + }); |
13 | 38 | });
|
14 | 39 | });
|
0 commit comments