Tofu/scripts/import-recipes/tests/listOdtFileNames.test.js
2026-09-18 01:41:02 +02:00

15 lines
601 B
JavaScript

import { test } from 'node:test'
import assert from 'node:assert/strict'
import { fileURLToPath } from 'node:url'
import { listOdtFileNames } from '#import-recipes/cli/listOdtFileNames.js'
// This very folder holds one .odt (the fixture) next to .js and .py files.
const TESTS_DIR = fileURLToPath(new URL('.', import.meta.url))
test('keeps the .odt files and nothing else', () => {
assert.deepEqual(listOdtFileNames(TESTS_DIR), ['sample-recipe.odt'])
})
test('throws on a folder that does not exist, for the CLI to report', () => {
assert.throws(() => listOdtFileNames(`${TESTS_DIR}/nope`))
})