Skip to content

Commit

Permalink
added a local file test to workspaces-ts
Browse files Browse the repository at this point in the history
  • Loading branch information
bumblehead committed Sep 13, 2023
1 parent 582b1bb commit ed4dcd5
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tests/tests-workspaces/workspaces-ts/ts-b/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import {foo} from 'ts-a'
import localfile from './local-file.js'

export default function test () {
return foo()
}

export const localfilewrap = () => localfile()
1 change: 1 addition & 0 deletions tests/tests-workspaces/workspaces-ts/ts-b/local-file.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default () => 'local-value'
8 changes: 8 additions & 0 deletions tests/tests-workspaces/workspaces-ts/ts-b/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,11 @@ test('works ootb', async () => {

assert.equal(sut(), 'bar')
})

test('also mocks local file', async () => {
const { localfilewrap } = await esmock('./index.js', {
'./local-file.js': () => 'local-value-mocked'
})

assert.equal(localfilewrap(), 'local-value-mocked')
})

0 comments on commit ed4dcd5

Please sign in to comment.