Skip to content

Commit

Permalink
edit README
Browse files Browse the repository at this point in the history
  • Loading branch information
bumblehead committed Jul 18, 2022
1 parent d158125 commit f2e9c2d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ test('should mock "await import()" using esmock.p', async () => {

// mock definition is returned from cache, when import is called
assert.strictEqual(await doAwaitImport('cfg'), 'cfg')
// a bit more info are found in the descriptive guide
})

// a "partial mock" merges the new and original definitions
Expand All @@ -91,12 +92,12 @@ test('should suppport partial mocks', async () => {
message: 'path.basename is not a function'
})

// use esmock.px to get a "partial mock"
// use esmock.px to create a "partial mock"
const pathWrapPartial = await esmock.px('../src/pathWrap.js', {
path: { dirname: () => '/home/' }
})

// no error, because "core" path.basename is merged into the mock
// no error, because "core" path.basename was merged into the mock
assert.deepEqual(pathWrapPartial.basename('/dog.png'), 'dog.png')
assert.deepEqual(pathWrapPartial.dirname(), '/home/')
})
Expand Down

0 comments on commit f2e9c2d

Please sign in to comment.