Add unit tests to verify data integrity
This commit is contained in:
@@ -17,6 +17,7 @@ module.exports = class CommandParserVersionBase
|
||||
|
||||
@_model = options.model
|
||||
@_showAllErrors = options.showAllErrors
|
||||
@errors = []
|
||||
|
||||
# Class Methods ################################################################################
|
||||
|
||||
@@ -38,6 +39,7 @@ module.exports = class CommandParserVersionBase
|
||||
parse: (text)->
|
||||
@_rawData = {}
|
||||
@_lineNumber = 1
|
||||
@errors = []
|
||||
|
||||
@_lines = text.split '\n'
|
||||
@_lineNumber = 0
|
||||
@@ -105,6 +107,7 @@ module.exports = class CommandParserVersionBase
|
||||
catch e
|
||||
e.message = "line #{@_lineNumber}: #{e.message}"
|
||||
if not @_showAllErrors then throw e
|
||||
@errors.push e
|
||||
logger.error -> e.message
|
||||
|
||||
_parseHereDoc: (line)->
|
||||
|
||||
@@ -12,6 +12,7 @@ module.exports = class VersionedParserBase
|
||||
constructor: (options={})->
|
||||
@_parsers = @_createParsers options
|
||||
@_currentSchema = _.chain(@_parsers).keys().last().value()
|
||||
@errors = []
|
||||
|
||||
# Class Members ################################################################################
|
||||
|
||||
@@ -27,6 +28,7 @@ module.exports = class VersionedParserBase
|
||||
if not parser? then throw new Error "schema version #{schema} is not supported"
|
||||
|
||||
parser.parse text
|
||||
@errors = parser.errors
|
||||
|
||||
return @_model
|
||||
|
||||
|
||||
Reference in New Issue
Block a user