import { test, expect } from 'vitest'; import { readFileSync } from 'fs-extra'; import { parse } from 'yaml'; import { solution_1, slice_and_dice } from './part1.js'; import { solution_2 } from './part2.js'; const input = readFileSync('./input',{ encoding: 'utf8'}); const example = readFileSync('./example',{ encoding: 'utf8'}); const solutions = parse( readFileSync('./solutions.yml',{encoding:'utf8'})); test( 'part 1', () => { expect( slice_and_dice( "Card 1: 41 48 83 86 17 | 83 86 6 31 17 9 48 53" )).toBe(8); expect( solution_1(example)).toBe(13); expect( solution_1(input)).toBe(solutions['1']); }) test( 'part 2', () => { expect( solution_2(input)).toBe(solutions['2']); })