From 5d4c6ffc882f09ba7bb7f10d837a4bcf4ca3f309 Mon Sep 17 00:00:00 2001 From: "Daniel W. Hieber" Date: Sat, 12 Oct 2024 02:04:28 -0500 Subject: [PATCH] DEV: Modularize test utility --- index.test.js | 18 ++++-------------- test/createDefaultTest.js | 14 ++++++++++++++ 2 files changed, 18 insertions(+), 14 deletions(-) create mode 100644 test/createDefaultTest.js diff --git a/index.test.js b/index.test.js index d94e5e6..6c8c5fe 100644 --- a/index.test.js +++ b/index.test.js @@ -1,20 +1,10 @@ -import dlx2scription from './index.js' -import { expect } from 'chai' -import fixtures from './test/index.js' +import createDefaultTest from './test/createDefaultTest.js' +import dlx2scription from './index.js' +import { expect } from 'chai' +import fixtures from './test/index.js' import { describe, it, test } from 'node:test' -function createDefaultTest(name) { - return function defaultTest() { - - const { data, scription } = fixtures.get(name) - const result = dlx2scription(data) - - expect(result).to.equal(scription) - - } -} - describe(`dlx2scription`, function() { describe(`library`, function() { diff --git a/test/createDefaultTest.js b/test/createDefaultTest.js new file mode 100644 index 0000000..6af7aa0 --- /dev/null +++ b/test/createDefaultTest.js @@ -0,0 +1,14 @@ +import dlx2scription from '../index.js' +import { expect } from 'chai' +import fixtures from './index.js' + +export default function createDefaultTest(name) { + return function defaultTest() { + + const { data, scription } = fixtures.get(name) + const result = dlx2scription(data) + + expect(result).to.equal(scription) + + } +}