-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chapter 07: refactored solution based in abstract test infrastructure…
… class pattern
- Loading branch information
Showing
3 changed files
with
22 additions
and
8 deletions.
There are no files selected for viewing
7 changes: 3 additions & 4 deletions
7
...hies-and-organization/abstractTestInfrastructureClassPattern/configurationManager.test.js
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 |
---|---|---|
@@ -1,13 +1,12 @@ | ||
const configurationManagerFactory = require('./configurationManager'); | ||
const loggingFacility = require('./loggingFacility'); | ||
const { fakeTheLogger, tearDown } = require('./testsUtils/baseTests'); | ||
|
||
describe('isConfigured', () => { | ||
it('logging file check', () => { | ||
fakeTheLogger(); | ||
const configurationManager = configurationManagerFactory(); | ||
configurationManager.isConfigured(''); | ||
}); | ||
|
||
afterEach(() => { | ||
loggingFacility.setLogger(null); | ||
}); | ||
afterEach(tearDown); | ||
}); |
7 changes: 3 additions & 4 deletions
7
...t-hierarchies-and-organization/abstractTestInfrastructureClassPattern/logAnalyzer.test.js
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 |
---|---|---|
@@ -1,13 +1,12 @@ | ||
const logAnalyzerFactory = require('./logAnalyzer'); | ||
const loggingFacility = require('./loggingFacility'); | ||
const { fakeTheLogger, tearDown } = require('./testsUtils/baseTests'); | ||
|
||
describe('analyze', () => { | ||
it('empty file throws exception', () => { | ||
fakeTheLogger(); | ||
const logAnalyzer = logAnalyzerFactory(); | ||
logAnalyzer.analyze(''); | ||
}); | ||
|
||
afterEach(() => { | ||
loggingFacility.setLogger(null); | ||
}); | ||
afterEach(tearDown); | ||
}); |
16 changes: 16 additions & 0 deletions
16
...erarchies-and-organization/abstractTestInfrastructureClassPattern/testsUtils/baseTests.js
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,16 @@ | ||
let loggingFacility = require('../loggingFacility'); | ||
|
||
function fakeTheLogger() { | ||
loggingFacility.setLogger(function fakeLogger(value) { | ||
return value; | ||
}); | ||
} | ||
|
||
function tearDown() { | ||
loggingFacility.setLogger(null); | ||
} | ||
|
||
module.exports = { | ||
fakeTheLogger, | ||
tearDown, | ||
}; |