Skip to content

Commit

Permalink
added bosschaert demo
Browse files Browse the repository at this point in the history
  • Loading branch information
bumblehead committed Apr 30, 2024
1 parent 7d0f56d commit 8d60c2d
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 1 deletion.
1 change: 1 addition & 0 deletions tests/local/bossch.fnimported.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const fnimported = () => 'un-mocked'
5 changes: 5 additions & 0 deletions tests/local/bossch.fnimporter.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { fnimported } from './bossch.fnimported.js'

export const fncaller = () => {
return fnimported()
}
13 changes: 13 additions & 0 deletions tests/tests-node/esmock.node.bossch.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import test from 'node:test'
import assert from 'assert'
import esmock from 'esmock'

test('should mock importedfn', async () => {
const { fncaller } = await esmock('../local/bossch.fnimporter.js', {
'../local/bossch.fnimported.js': {
fnimported: () => 'mocky'
}
})

assert.equal('mocky', fncaller())
})
2 changes: 1 addition & 1 deletion tests/tests-node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"description": "esmock unit tests, node native runner",
"repository": {
"type": "git",
"url": "https://github.com/iambumblehead/esmock.git"
"url": "gi+https://github.com/iambumblehead/esmock.git"
},
"dependencies": {
"esmock": "file:..",
Expand Down

0 comments on commit 8d60c2d

Please sign in to comment.