Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: fix mockContext with headers (#153)
mock headers when reuse context.
- Loading branch information
Showing
7 changed files
with
100 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
'use strict'; | ||
|
||
module.exports = { | ||
keys: '123', | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"name": "app" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
const assert = require('assert'); | ||
const { app } = require('../../../../bootstrap'); | ||
|
||
describe('test/index.test.ts', () => { | ||
describe('hook error', () => { | ||
beforeEach(() => { | ||
assert.fail('failed hook'); | ||
}); | ||
|
||
it('should fail', () => { | ||
// eslint-disable-next-line no-undef | ||
assert(app.currentContext); | ||
assert.fail('failed case'); | ||
}); | ||
}); | ||
|
||
describe('mockContext failed', () => { | ||
before(() => { | ||
app.mockContextScope = () => { | ||
throw new Error('mockContextScope error'); | ||
}; | ||
}); | ||
|
||
it('foo', () => { | ||
//... | ||
}); | ||
|
||
it('should not run', () => { | ||
console.log('it should not run'); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters