-
-
Notifications
You must be signed in to change notification settings - Fork 111
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(map): add property based flag (#728)
* feat(map): add property based flag Signed-off-by: Jonathan Casey <[email protected]> * fix typo Signed-off-by: Jonathan Casey <[email protected]> --------- Signed-off-by: Jonathan Casey <[email protected]>
- Loading branch information
1 parent
3337541
commit e067cc3
Showing
3 changed files
with
27 additions
and
4 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 |
---|---|---|
|
@@ -84,11 +84,29 @@ describe('MapDeclaration', () => { | |
$class: '[email protected]' | ||
} | ||
}); | ||
}).should.throw(/MapType feature is not enabled. Please set the environment variable "ENABLE_MAP_TYPE=true" to access this functionality./); | ||
}).should.throw(/MapType feature is not enabled. Please set the environment variable "ENABLE_MAP_TYPE=true", or add {enableMapType: true} to the ModelManger options, to access this functionality/); | ||
process.env.ENABLE_MAP_TYPE = 'true'; // enable after the test run. This is necessary to ensure functioning of other tests. | ||
}); | ||
|
||
|
||
it('should throw if Map Type not enabled in ModelManager options', () => { | ||
process.env.ENABLE_MAP_TYPE = 'false'; | ||
const mm = new ModelManager({enableMapType: false}); | ||
Util.addComposerModel(mm); | ||
const introspectUtils = new IntrospectUtils(mm); | ||
try { | ||
introspectUtils.loadLastDeclaration('test/data/parser/mapdeclaration/mapdeclaration.goodkey.primitive.datetime.cto', MapDeclaration); | ||
} catch (error) { | ||
expect(error.message).to.equal('MapType feature is not enabled. Please set the environment variable "ENABLE_MAP_TYPE=true", or add {enableMapType: true} to the ModelManger options, to access this functionality.'); | ||
} | ||
}); | ||
|
||
it('should not throw if Map Type is enabled in ModelManager options', () => { | ||
const mm = new ModelManager({enableMapType: true}); | ||
Util.addComposerModel(mm); | ||
const introspectUtils = new IntrospectUtils(mm); | ||
let decl = introspectUtils.loadLastDeclaration('test/data/parser/mapdeclaration/mapdeclaration.goodkey.primitive.datetime.cto', MapDeclaration); | ||
decl.validate(); | ||
}); | ||
|
||
it('should throw if invalid $class provided for Map Key', () => { | ||
(() => | ||
|