Skip to content

Commit

Permalink
refactor: Cleanup
Browse files Browse the repository at this point in the history
Cleanup tests
  • Loading branch information
marcobiedermann committed Nov 29, 2024
1 parent 3e30206 commit 1bda799
Show file tree
Hide file tree
Showing 40 changed files with 89 additions and 100 deletions.
4 changes: 0 additions & 4 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,3 @@ updates:
patterns:
- '@types/lodash-es'
- 'lodash-es'
vitest:
patterns:
- '@vitest/*'
- 'vitest'
4 changes: 2 additions & 2 deletions 2015/day/12/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import assert from 'node:assert/strict';
import { readFile } from 'node:fs/promises';
import { describe, it } from 'node:test';
import { getInput } from '../../../utils/file.ts';
import { part1 } from './index.ts';

const input = await readFile(`${import.meta.dirname}/input`, 'utf-8');
const input = await getInput(import.meta.dirname);

describe('Day 12', () => {
describe('Part 1', () => {
Expand Down
4 changes: 2 additions & 2 deletions 2015/day/14/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import assert from 'node:assert/strict';
import { readFile } from 'node:fs/promises';
import { describe, it } from 'node:test';
import { getInput } from '../../../utils/file.ts';
import { part1 } from './index.ts';

const input = (await readFile(`${import.meta.dirname}/input`, 'utf-8')).split('\n');
const input = (await getInput(import.meta.dirname)).split('\n');

describe('Day 14', () => {
describe('Part 1', () => {
Expand Down
4 changes: 2 additions & 2 deletions 2015/day/16/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import assert from 'node:assert/strict';
import { readFile } from 'node:fs/promises';
import { describe, it } from 'node:test';
import { getInput } from '../../../utils/file.ts';
import { part1 } from './index.ts';

const input = (await readFile(`${import.meta.dirname}/input`, 'utf-8')).split('\n');
const input = (await getInput(import.meta.dirname)).split('\n');

describe('Day 16', () => {
describe('Part 1', () => {
Expand Down
4 changes: 2 additions & 2 deletions 2016/day/1/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import assert from 'node:assert/strict';
import { readFile } from 'node:fs/promises';
import { describe, it } from 'node:test';
import { getInput } from '../../../utils/file.ts';
import { part1 } from './index.ts';

const input = (await readFile(`${import.meta.dirname}/input`, 'utf-8')).split(', ');
const input = (await getInput(import.meta.dirname)).split(', ');

describe('Day 1', () => {
describe('Part 1', () => {
Expand Down
6 changes: 3 additions & 3 deletions 2016/day/2/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import assert from 'node:assert/strict';
import { readFile } from 'node:fs/promises';
import { describe, it } from 'node:test';
import { getInput, getInputSample } from '../../../utils/file.ts';
import { part1, part2 } from './index.ts';

const input = (await readFile(`${import.meta.dirname}/input`, 'utf-8')).split('\n');
const inputSample = (await readFile(`${import.meta.dirname}/input.sample`, 'utf-8')).split('\n');
const input = (await getInput(import.meta.dirname)).split('\n');
const inputSample = (await getInputSample(import.meta.dirname)).split('\n');

describe('Day 2', () => {
describe('Part 1', () => {
Expand Down
4 changes: 2 additions & 2 deletions 2016/day/3/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import assert from 'node:assert/strict';
import { readFile } from 'node:fs/promises';
import { describe, it } from 'node:test';
import { getInput } from '../../../utils/file.ts';
import { part1, part2 } from './index.ts';

const input = (await readFile(`${import.meta.dirname}/input`, 'utf-8')).split('\n');
const input = (await getInput(import.meta.dirname)).split('\n');

describe('2016 Day 3', () => {
describe('Part 1', () => {
Expand Down
4 changes: 2 additions & 2 deletions 2016/day/4/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import assert from 'node:assert/strict';
import { readFile } from 'node:fs/promises';
import { describe, it } from 'node:test';
import { getInput } from '../../../utils/file.ts';
import { part1, part2 } from './index.ts';

const input = (await readFile(`${import.meta.dirname}/input`, 'utf-8')).split('\n');
const input = (await getInput(import.meta.dirname)).split('\n');

describe('2016 Day 3', () => {
describe('Part 1', () => {
Expand Down
6 changes: 3 additions & 3 deletions 2016/day/6/input.test.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import assert from 'node:assert/strict';
import { readFile } from 'node:fs/promises';
import { describe, it } from 'node:test';
import { getInput, getInputSample } from '../../../utils/file.ts';
import { part1, part2 } from './index.ts';

const input = (await readFile(`${import.meta.dirname}/input`, 'utf-8')).split('\n');
const inputSample = (await readFile(`${import.meta.dirname}/input.sample`, 'utf-8')).split('\n');
const input = (await getInput(import.meta.dirname)).split('\n');
const inputSample = (await getInputSample(import.meta.dirname)).split('\n');

describe('2016 Day 6', () => {
describe('Part 1', () => {
Expand Down
4 changes: 2 additions & 2 deletions 2017/day/1/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import assert from 'node:assert/strict';
import { readFile } from 'node:fs/promises';
import { describe, it } from 'node:test';
import { getInput } from '../../../utils/file.ts';
import { part1 } from './index.ts';

const input = (await readFile(`${import.meta.dirname}/input`, 'utf-8')).split('').map(Number);
const input = (await getInput(import.meta.dirname)).split('').map(Number);

describe('Day 1', () => {
describe('Part 1', () => {
Expand Down
4 changes: 2 additions & 2 deletions 2017/day/2/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import assert from 'node:assert/strict';
import { readFile } from 'node:fs/promises';
import { describe, it } from 'node:test';
import { getInput } from '../../../utils/file.ts';
import { part1 } from './index.ts';

const input = (await readFile(`${import.meta.dirname}/input`, 'utf-8'))
const input = (await getInput(import.meta.dirname))
.split('\n')
.map((row) => row.split('\t').map(Number));

Expand Down
4 changes: 2 additions & 2 deletions 2017/day/4/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import assert from 'node:assert/strict';
import { readFile } from 'node:fs/promises';
import { describe, it } from 'node:test';
import { getInput } from '../../../utils/file.ts';
import { part1 } from './index.ts';

const input = (await readFile(`${import.meta.dirname}/input`, 'utf-8')).split('\n');
const input = (await getInput(import.meta.dirname)).split('\n');

describe('Day 4', () => {
describe('Part 1', () => {
Expand Down
4 changes: 2 additions & 2 deletions 2018/day/1/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import assert from 'node:assert/strict';
import { readFile } from 'node:fs/promises';
import { describe, it } from 'node:test';
import { getInput } from '../../../utils/file.ts';
import { part1, part2 } from './index.ts';

const input = (await readFile(`${import.meta.dirname}/input`, 'utf-8')).split('\n').map(Number);
const input = (await getInput(import.meta.dirname)).split('\n').map(Number);

describe('day-01', () => {
describe('Part 1', () => {
Expand Down
4 changes: 2 additions & 2 deletions 2018/day/2/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import assert from 'node:assert/strict';
import { readFile } from 'node:fs/promises';
import { describe, it } from 'node:test';
import { getInput } from '../../../utils/file.ts';
import { part1 } from './index.ts';

const input = (await readFile(`${import.meta.dirname}/input`, 'utf-8')).split('\n');
const input = (await getInput(import.meta.dirname)).split('\n');

describe('Day 2', () => {
describe('Part 1', () => {
Expand Down
6 changes: 3 additions & 3 deletions 2018/day/3/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import assert from 'node:assert/strict';
import { readFile } from 'node:fs/promises';
import { describe, it } from 'node:test';
import { getInput, getInputSample } from '../../../utils/file.ts';
import { part1 } from './index.ts';

const input = (await readFile(`${import.meta.dirname}/input`, 'utf-8')).split('\n');
const inputSample = (await readFile(`${import.meta.dirname}/input.sample`, 'utf-8')).split('\n');
const input = (await getInput(import.meta.dirname)).split('\n');
const inputSample = (await getInputSample(import.meta.dirname)).split('\n');

describe('Day 3', () => {
describe('Part 1', () => {
Expand Down
4 changes: 2 additions & 2 deletions 2018/day/5/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import assert from 'node:assert/strict';
import { readFile } from 'node:fs/promises';
import { describe, it } from 'node:test';
import { getInput } from '../../../utils/file.ts';
import { part1 } from './index.ts';

const input = await readFile(`${import.meta.dirname}/input`, 'utf-8');
const input = await getInput(import.meta.dirname);

describe('Day 5', () => {
describe('Part 1', () => {
Expand Down
4 changes: 2 additions & 2 deletions 2019/day/1/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import assert from 'node:assert/strict';
import { readFile } from 'node:fs/promises';
import { describe, it } from 'node:test';
import { getInput } from '../../../utils/file.ts';
import { part1, part2 } from './index.ts';

const input = (await readFile(`${import.meta.dirname}/input`, 'utf-8')).split('\n').map(Number);
const input = (await getInput(import.meta.dirname)).split('\n').map(Number);

describe('Day 1', () => {
describe('Part 1', () => {
Expand Down
4 changes: 2 additions & 2 deletions 2019/day/2/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import assert from 'node:assert/strict';
import { readFile } from 'node:fs/promises';
import { describe, it } from 'node:test';
import { getInput } from '../../../utils/file.ts';
import { part1, part2 } from './index.ts';

const input = (await readFile(`${import.meta.dirname}/input`, 'utf-8')).split(',').map(Number);
const input = (await getInput(import.meta.dirname)).split(',').map(Number);

describe('Day 1', () => {
describe('Part 1', () => {
Expand Down
6 changes: 2 additions & 4 deletions 2019/day/4/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import assert from 'node:assert/strict';
import { readFile } from 'node:fs/promises';
import { describe, it } from 'node:test';
import { getInput } from '../../../utils/file.ts';
import { part1, part2 } from './index.ts';

const [lower, upper] = (await readFile(`${import.meta.dirname}/input`, 'utf-8'))
.split('-')
.map(Number);
const [lower, upper] = (await getInput(import.meta.dirname)).split('-').map(Number);

describe('Day 4', () => {
describe('Part 1', () => {
Expand Down
4 changes: 2 additions & 2 deletions 2020/day/1/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import assert from 'node:assert/strict';
import { readFile } from 'node:fs/promises';
import { describe, it } from 'node:test';
import { getInput } from '../../../utils/file.ts';
import { part1, part2 } from './index.ts';

const input = (await readFile(`${import.meta.dirname}/input`, 'utf-8')).split('\n').map(Number);
const input = (await getInput(import.meta.dirname)).split('\n').map(Number);

describe('Day 1', () => {
describe('Part 1', () => {
Expand Down
4 changes: 2 additions & 2 deletions 2020/day/10/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import assert from 'node:assert/strict';
import { readFile } from 'node:fs/promises';
import { describe, it } from 'node:test';
import { getInput } from '../../../utils/file.ts';
import { part1, part2 } from './index.ts';

const input = (await readFile(`${import.meta.dirname}/input`, 'utf-8')).split('\n').map(Number);
const input = (await getInput(import.meta.dirname)).split('\n').map(Number);
const exampleInput = [16, 10, 15, 5, 1, 11, 7, 19, 6, 12, 4];
const largerExampleInput = [
28, 33, 18, 42, 31, 14, 46, 20, 48, 47, 24, 23, 49, 45, 19, 38, 39, 11, 1, 32, 25, 35, 8, 17, 7,
Expand Down
4 changes: 2 additions & 2 deletions 2020/day/12/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import assert from 'node:assert/strict';
import { readFile } from 'node:fs/promises';
import { describe, it } from 'node:test';
import { getInput } from '../../../utils/file.ts';
import { part1, part2 } from './index.ts';

const input = (await readFile(`${import.meta.dirname}/input`, 'utf-8')).split('\n');
const input = (await getInput(import.meta.dirname)).split('\n');
const exampleInput = ['F10', 'N3', 'F7', 'R90', 'F11'];

describe('Day 12', () => {
Expand Down
4 changes: 2 additions & 2 deletions 2020/day/2/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import assert from 'node:assert/strict';
import { readFile } from 'node:fs/promises';
import { describe, it } from 'node:test';
import { getInput } from '../../../utils/file.ts';
import { part1, part2 } from './index.ts';

const input = (await readFile(`${import.meta.dirname}/input`, 'utf-8')).split('\n');
const input = (await getInput(import.meta.dirname)).split('\n');

describe('Day 1', () => {
describe('Part 1', () => {
Expand Down
4 changes: 2 additions & 2 deletions 2020/day/25/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import assert from 'node:assert/strict';
import { readFile } from 'node:fs/promises';
import { describe, it } from 'node:test';
import { getInput } from '../../../utils/file.ts';
import { part1 } from './index.ts';

const input = (await readFile(`${import.meta.dirname}/input`, 'utf-8')).split('\n').map(Number);
const input = (await getInput(import.meta.dirname)).split('\n').map(Number);

describe('Day 25', () => {
describe('Part 1', () => {
Expand Down
4 changes: 2 additions & 2 deletions 2020/day/3/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import assert from 'node:assert/strict';
import { readFile } from 'node:fs/promises';
import { describe, it } from 'node:test';
import { getInput } from '../../../utils/file.ts';
import type { Slope } from './index.ts';
import { part1, part2 } from './index.ts';

Expand All @@ -15,7 +15,7 @@ const exampleInput = `..##.........##.........##.........##.........##.........#
#.##...#...#.##...#...#.##...#...#.##...#...#.##...#...#.##...#...
#...##....##...##....##...##....##...##....##...##....##...##....#
.#..#...#.#.#..#...#.#.#..#...#.#.#..#...#.#.#..#...#.#.#..#...#.#`.split('\n');
const input = (await readFile(`${import.meta.dirname}/input`, 'utf-8')).split('\n');
const input = (await getInput(import.meta.dirname)).split('\n');

describe('Day 3', () => {
describe('Part 1', () => {
Expand Down
4 changes: 2 additions & 2 deletions 2020/day/4/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import assert from 'node:assert/strict';
import { readFile } from 'node:fs/promises';
import { describe, it } from 'node:test';
import { getInput } from '../../../utils/file.ts';
import { part1, part2 } from './index.ts';

const input = (await readFile(`${import.meta.dirname}/input`, 'utf-8')).split('\n\n');
const input = (await getInput(import.meta.dirname)).split('\n\n');

describe('Day 4', () => {
describe('Part 1', () => {
Expand Down
4 changes: 2 additions & 2 deletions 2020/day/5/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import assert from 'node:assert/strict';
import { readFile } from 'node:fs/promises';
import { describe, it } from 'node:test';
import { getInput } from '../../../utils/file.ts';
import { part1, part2 } from './index.ts';

const input = (await readFile(`${import.meta.dirname}/input`, 'utf-8')).split('\n');
const input = (await getInput(import.meta.dirname)).split('\n');

describe('Day 5', () => {
describe('Part 1', () => {
Expand Down
6 changes: 3 additions & 3 deletions 2020/day/6/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import assert from 'node:assert/strict';
import { readFile } from 'node:fs/promises';
import { describe, it } from 'node:test';
import { getInput, getInputSample } from '../../../utils/file.ts';
import { part1, part2 } from './index.ts';

const input = (await readFile(`${import.meta.dirname}/input`, 'utf-8')).split('\n\n');
const sampleInput = (await readFile(`${import.meta.dirname}/input.sample`, 'utf-8')).split('\n\n');
const input = (await getInput(import.meta.dirname)).split('\n\n');
const sampleInput = (await getInputSample(import.meta.dirname)).split('\n\n');

describe('Day 6', () => {
describe('Part 1', () => {
Expand Down
8 changes: 3 additions & 5 deletions 2020/day/9/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import assert from 'node:assert/strict';
import { readFile } from 'node:fs/promises';
import { describe, it } from 'node:test';
import { getInput, getInputSample } from '../../../utils/file.ts';
import { part1, part2 } from './index.ts';

const input = (await readFile(`${import.meta.dirname}/input`, 'utf-8')).split('\n').map(Number);
const sampleInput = (await readFile(`${import.meta.dirname}/input.sample`, 'utf-8'))
.split('\n')
.map(Number);
const input = (await getInput(import.meta.dirname)).split('\n').map(Number);
const sampleInput = (await getInputSample(import.meta.dirname)).split('\n').map(Number);

describe('Day 9', () => {
describe('Part 1', () => {
Expand Down
4 changes: 2 additions & 2 deletions 2021/day/1/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import assert from 'node:assert/strict';
import { readFile } from 'node:fs/promises';
import { describe, it } from 'node:test';
import { getInput } from '../../../utils/file.ts';
import { part1, part2 } from './index.ts';

const input = (await readFile(`${import.meta.dirname}/input`, 'utf-8')).split('\n').map(Number);
const input = (await getInput(import.meta.dirname)).split('\n').map(Number);
const sampleInput = [199, 200, 208, 210, 200, 207, 240, 269, 260, 263];

describe('2021 Day 1', () => {
Expand Down
4 changes: 2 additions & 2 deletions 2021/day/2/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import assert from 'node:assert/strict';
import { readFile } from 'node:fs/promises';
import { describe, it } from 'node:test';
import { getInput } from '../../../utils/file.ts';
import { part1, part2 } from './index.ts';

const input = (await readFile(`${import.meta.dirname}/input`, 'utf-8')).split('\n');
const input = (await getInput(import.meta.dirname)).split('\n');
const sampleInput = ['forward 5', 'down 5', 'forward 8', 'up 3', 'down 8', 'forward 2'];

describe('2021 Day 2', () => {
Expand Down
4 changes: 2 additions & 2 deletions 2021/day/3/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import assert from 'node:assert/strict';
import { readFile } from 'node:fs/promises';
import { describe, it } from 'node:test';
import { getInput } from '../../../utils/file.ts';
import { part1, part2 } from './index.ts';

const input = (await readFile(`${import.meta.dirname}/input`, 'utf-8')).split('\n');
const input = (await getInput(import.meta.dirname)).split('\n');
const sampleInput = [
'00100',
'11110',
Expand Down
Loading

0 comments on commit 1bda799

Please sign in to comment.