-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from KevinAst/initial
master PR for code coverage (Take II)
- Loading branch information
Showing
5 changed files
with
252 additions
and
14 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
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 |
---|---|---|
@@ -1,10 +1,113 @@ | ||
import {logicAspect} from '..'; // STOP USING: '../../tooling/ModuleUnderTest'; | ||
import {createFeature} from 'feature-u'; | ||
import {logicAspect} from '..'; // modules under test | ||
|
||
// temporarly turn on logging (just for fun) | ||
// ... must include launchApp on this | ||
// launchApp.diag.logf.enable(); | ||
|
||
describe('logicAspect() tests', () => { | ||
|
||
test('name', () => { | ||
expect( logicAspect.name) | ||
.toEqual('logic'); | ||
describe('validate logicAspect.name', () => { | ||
|
||
test('name', () => { | ||
expect( logicAspect.name) | ||
.toBe('logic'); | ||
}); | ||
|
||
}); | ||
|
||
|
||
describe('genesis()', () => { | ||
|
||
logicAspect.genesis(); | ||
|
||
const noOpTest = "can't access isAspectProperty() ... just running code :-("; | ||
test('verify extendAspectProperty()', () => { | ||
expect(noOpTest) | ||
.toBe(noOpTest); | ||
}); | ||
|
||
}); | ||
|
||
|
||
describe('validateFeatureContent()', () => { | ||
|
||
test('must be an array', () => { | ||
|
||
const feature = createFeature({ | ||
name: 'feature1', | ||
logic: "I'm NOT an array", | ||
}); | ||
|
||
expect(logicAspect.validateFeatureContent(feature)) | ||
.toMatch(/must be an array/); | ||
}); | ||
|
||
test('success', () => { | ||
|
||
const feature = createFeature({ | ||
name: 'feature1', | ||
logic: ['mock', 'logic', 'modules'], | ||
}); | ||
|
||
expect(logicAspect.validateFeatureContent(feature)) | ||
.toBe(null); | ||
}); | ||
|
||
}); | ||
|
||
|
||
describe('assembleFeatureContent()', () => { | ||
|
||
test('no logic modules (DEFAULT)', () => { | ||
expect(()=>logicAspect.assembleFeatureContent('simulated app', [])) | ||
.toThrow(/found NO logic modules within your features/); | ||
}); | ||
|
||
describe('no logic modules (OVERRIDE true)', () => { | ||
beforeEach(() => { | ||
logicAspect.allowNoLogic$ = true; | ||
}); | ||
afterEach(() => { | ||
logicAspect.allowNoLogic$ = false; | ||
}); | ||
test('expecting getReduxMiddleware() to be null', () => { | ||
logicAspect.assembleFeatureContent('simulated app', []); | ||
expect(logicAspect.getReduxMiddleware()) | ||
.toBe(null); | ||
}); | ||
}); | ||
|
||
describe('no logic modules (OVERRIDE array)', () => { | ||
beforeEach(() => { | ||
logicAspect.allowNoLogic$ = ['simulated', 'logic']; | ||
}); | ||
afterEach(() => { | ||
logicAspect.allowNoLogic$ = false; | ||
}); | ||
test('expecting getReduxMiddleware() to be non-null', () => { | ||
logicAspect.assembleFeatureContent('simulated app', []); | ||
expect(logicAspect.getReduxMiddleware()) | ||
.not.toBe(null); | ||
}); | ||
}); | ||
|
||
describe('features have logic modules', () => { | ||
test('expecting getReduxMiddleware() to be non-null', () => { | ||
logicAspect.assembleFeatureContent('simulated app', [ | ||
createFeature({ | ||
name: 'feature1', | ||
logic: ['simulated', 'logic'] | ||
}), | ||
createFeature({ | ||
name: 'featureWithNoLogic', | ||
}) | ||
]); | ||
expect(logicAspect.getReduxMiddleware()) | ||
.not.toBe(null); | ||
}); | ||
}); | ||
|
||
}); | ||
|
||
}); |