From 759e1c072ee4304777ac9809fb1735793786f1bf Mon Sep 17 00:00:00 2001 From: 16808507970f18ea89a07ad1d30b53e7e3a3891d <16808507970f18ea89a07ad1d30b53e7e3a3891d@users.noreply.invalid> Date: Fri, 2 Oct 2026 06:43:22 +0000 Subject: [PATCH] Solution 0xf54069ff336d8ad5b45c25e108e462821befc0a9d40b83949a7e7f333f0390f2 T2T-Item: 0xf54069ff336d8ad5b45c25e108e462821befc0a9d40b83949a7e7f333f0390f2 T2T-Issue: 0xb808c26a4cf912dcceaaa1cdf81dd5430e77b8592836e44b85927e62752428d0 --- tests/acceptance/2/CRITERIA.json | 24 ++++++++++++++++++++++++ tests/acceptance/2/criteria.test.js | 20 ++++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 tests/acceptance/2/CRITERIA.json create mode 100644 tests/acceptance/2/criteria.test.js diff --git a/tests/acceptance/2/CRITERIA.json b/tests/acceptance/2/CRITERIA.json new file mode 100644 index 0000000..18e786f --- /dev/null +++ b/tests/acceptance/2/CRITERIA.json @@ -0,0 +1,24 @@ +{ + "schema": "elffuss-t2t/criteria@2", + "issue": 2, + "criteria": [ + { + "index": 1, + "tests": [ + "tests/acceptance/2/criteria.test.js::criterion 1" + ] + }, + { + "index": 2, + "tests": [ + "tests/acceptance/2/criteria.test.js::criterion 2" + ] + }, + { + "index": 3, + "tests": [ + "tests/acceptance/2/criteria.test.js::criterion 3" + ] + } + ] +} diff --git a/tests/acceptance/2/criteria.test.js b/tests/acceptance/2/criteria.test.js new file mode 100644 index 0000000..5794ff4 --- /dev/null +++ b/tests/acceptance/2/criteria.test.js @@ -0,0 +1,20 @@ +import { test } from 'node:test' +import assert from 'node:assert/strict' +import { readFileSync } from 'node:fs' +import * as mod from '../../../web/js/skills.js' // the code under test: call it as mod.(...) +const source = readFileSync(new URL('../../../web/js/skills.js', import.meta.url), 'utf8') // the text of web/js/skills.js, for a criterion about how the file is written + +test('criterion 1', () => { + // `parseSkill("---\r\nname: demo\r\ndescription: x\r\n---\r\nBody")` returns `{ name: "demo", description: "x", content: "Body" }`. + assert.deepEqual(mod.parseSkill("---\r\nname: demo\r\ndescription: x\r\n---\r\nBody"), { name: "demo", description: "x", content: "Body" }) +}) + +test('criterion 2', () => { + // `parseSkill("---\nname: demo\ndescription: x\n---\nBody")` returns `{ name: "demo", description: "x", content: "Body" }`. + assert.deepEqual(mod.parseSkill("---\nname: demo\ndescription: x\n---\nBody"), { name: "demo", description: "x", content: "Body" }) +}) + +test('criterion 3', () => { + // `parseSkill("Body only", "fallback")` returns `{ name: "fallback", description: "", content: "Body only" }`. + assert.deepEqual(mod.parseSkill("Body only", "fallback"), { name: "fallback", description: "", content: "Body only" }) +})