Skip to content

Commit

Permalink
DEV: Modularize test utility
Browse files Browse the repository at this point in the history
  • Loading branch information
dwhieb committed Oct 12, 2024
1 parent 31422c2 commit 5d4c6ff
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 14 deletions.
18 changes: 4 additions & 14 deletions index.test.js
Original file line number Diff line number Diff line change
@@ -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() {
Expand Down
14 changes: 14 additions & 0 deletions test/createDefaultTest.js
Original file line number Diff line number Diff line change
@@ -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)

}
}

0 comments on commit 5d4c6ff

Please sign in to comment.