wip
This commit is contained in:
@@ -11,24 +11,30 @@ ParserExtension = require '../parser_extension'
|
||||
|
||||
module.exports = class CurrentParserExtensionV1 extends ParserExtension
|
||||
|
||||
constructor: (data)->
|
||||
super data, null,
|
||||
documentationUrl: @_command_documentationUrl
|
||||
description: @_command_description
|
||||
name: @_command_name
|
||||
|
||||
# Command Methods ##############################################################################
|
||||
|
||||
_command_documentationUrl: (command)->
|
||||
current = @state.getCurrent()
|
||||
current = @data.getCurrent()
|
||||
return if @duplicateField command, current, 'documentationUrl'
|
||||
return if @missingArgText command
|
||||
|
||||
current.documentationUrl = command.argText
|
||||
|
||||
_command_description: (command)->
|
||||
current = @state.getCurrent()
|
||||
current = @data.getCurrent()
|
||||
return if @duplicateField command, current, 'description'
|
||||
return if @missingArgText command
|
||||
|
||||
current.description = command.argText
|
||||
|
||||
_command_name: (command)->
|
||||
current = @state.getCurrent()
|
||||
current = @data.getCurrent()
|
||||
return if @duplicateField command, current, 'name'
|
||||
return if @missingArgText command
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#
|
||||
|
||||
CurrentParserExtensionV1 = require './current_pe_v1'
|
||||
ParserState = require '../parser_state'
|
||||
ParserData = require '../parser_data'
|
||||
|
||||
########################################################################################################################
|
||||
|
||||
@@ -17,7 +17,7 @@ parser = state = null
|
||||
describe 'current_pe_v1.coffee', ->
|
||||
|
||||
beforeEach ->
|
||||
state = new ParserState
|
||||
state = new ParserData
|
||||
parser = new CurrentParserExtensionV1 state
|
||||
|
||||
state.create {}, 'alpha'
|
||||
@@ -26,22 +26,19 @@ describe 'current_pe_v1.coffee', ->
|
||||
|
||||
it 'assigns to the current object', ->
|
||||
parser.execute name:'documentationUrl', argText:'bravo'
|
||||
.then ->
|
||||
state.getCurrent().documentationUrl.should.equal 'bravo'
|
||||
state.errors.should.eql []
|
||||
state.getCurrent().documentationUrl.should.equal 'bravo'
|
||||
state.errors.should.eql []
|
||||
|
||||
describe 'description', ->
|
||||
|
||||
it 'assigns to the current object', ->
|
||||
parser.execute name:'description', argText:'bravo'
|
||||
.then ->
|
||||
state.getCurrent().description.should.equal 'bravo'
|
||||
state.errors.should.eql []
|
||||
state.getCurrent().description.should.equal 'bravo'
|
||||
state.errors.should.eql []
|
||||
|
||||
describe 'name', ->
|
||||
|
||||
it 'assigns to the current object', ->
|
||||
parser.execute name:'name', argText:'bravo'
|
||||
.then ->
|
||||
state.getCurrent().name.should.equal 'bravo'
|
||||
state.errors.should.eql []
|
||||
state.getCurrent().name.should.equal 'bravo'
|
||||
state.errors.should.eql []
|
||||
|
||||
@@ -11,6 +11,22 @@ ParserExtension = require '../parser_extension'
|
||||
|
||||
module.exports = class ItemParserExtensionV1 extends ParserExtension
|
||||
|
||||
constructor: (data)->
|
||||
super data, 'item',
|
||||
gatherable: @_command_gatherable
|
||||
item: @_command_item
|
||||
|
||||
# ParserExtensions Overrides ###################################################################
|
||||
|
||||
assmeble: (entry)->
|
||||
throw new Error "#{@constructor.name} must override the `assemble` method"
|
||||
|
||||
build: (entry)->
|
||||
entry.instance = new
|
||||
throw new Error "#{@constructor.name} must override the `build` method"
|
||||
|
||||
validate: (entry)-> # do nothing
|
||||
|
||||
# Command Methods ##############################################################################
|
||||
|
||||
_command_gatherable: (command)->
|
||||
@@ -18,7 +34,7 @@ module.exports = class ItemParserExtensionV1 extends ParserExtension
|
||||
|
||||
return if @missingCurrent command, 'item'
|
||||
|
||||
item = @state.getCurrent 'item'
|
||||
item = @data.getCurrent 'item'
|
||||
return if @duplicateField command, 'gatherable', item
|
||||
|
||||
gatherable = @parseBoolean command, command.argText
|
||||
@@ -31,10 +47,19 @@ module.exports = class ItemParserExtensionV1 extends ParserExtension
|
||||
return if @missingCurrent command, 'modVersion'
|
||||
return if @alreadyExists command, 'item', command.argText
|
||||
|
||||
item = @state.create command, 'item', command.argText
|
||||
item = @data.create command, 'item', command.argText
|
||||
item.name = command.argText
|
||||
|
||||
group = @state.getCurrent 'itemGroup'
|
||||
group = @data.getCurrent 'itemGroup'
|
||||
if group? then item.group = group
|
||||
|
||||
item.modVersion = @state.getCurrent 'modVersion'
|
||||
item.modVersion = @data.getCurrent 'modVersion'
|
||||
|
||||
_command_video: (command)->
|
||||
return if @missingArgs command
|
||||
return if @missingCurrent command, 'item'
|
||||
return if @tooFewArguments command, 2
|
||||
|
||||
item = @data.getCurrent 'item'
|
||||
item.videos ?= []
|
||||
item.videos.push youTubeId:command.args[0], caption:command.args[1..].join(', ')
|
||||
|
||||
@@ -6,41 +6,39 @@
|
||||
#
|
||||
|
||||
ItemParserExtensionV1 = require './item_pe_v1'
|
||||
ParserState = require '../parser_state'
|
||||
ParserData = require '../parser_data'
|
||||
|
||||
########################################################################################################################
|
||||
|
||||
parser = state = null
|
||||
parser = data = null
|
||||
|
||||
########################################################################################################################
|
||||
|
||||
describe 'item_pe_v1.coffee', ->
|
||||
|
||||
beforeEach ->
|
||||
state = new ParserState
|
||||
parser = new ItemParserExtensionV1 state
|
||||
data = new ParserData
|
||||
parser = new ItemParserExtensionV1 data
|
||||
|
||||
state.create {}, 'modVersion', 0
|
||||
data.create {}, 'modVersion', 0
|
||||
|
||||
describe 'gatherable', ->
|
||||
|
||||
it 'assigns to the current item', ->
|
||||
state.create {}, 'item', 1
|
||||
data.create {}, 'item', 1
|
||||
|
||||
parser.execute name:'gatherable', argText:'yes'
|
||||
.then ->
|
||||
state.getCurrent('item').gatherable.should.be.true
|
||||
state.errors.should.eql []
|
||||
data.getCurrent('item').gatherable.should.be.true
|
||||
data.errors.should.eql []
|
||||
|
||||
describe 'item', ->
|
||||
|
||||
it 'creates a new item', ->
|
||||
state.create {}, 'itemGroup', 2
|
||||
data.create {}, 'itemGroup', 2
|
||||
|
||||
parser.execute name:'item', argText:'alpha'
|
||||
.then ->
|
||||
item = state.getCurrent 'item'
|
||||
item.id.should.equal 'alpha'
|
||||
item.name.should.equal 'alpha'
|
||||
item.modVersion.id.should.equal 0
|
||||
item.group.id.should.equal 2
|
||||
item = data.getCurrent 'item'
|
||||
item.id.should.equal 'alpha'
|
||||
item.name.should.equal 'alpha'
|
||||
item.modVersion.id.should.equal 0
|
||||
item.group.id.should.equal 2
|
||||
|
||||
@@ -11,12 +11,19 @@ ParserExtension = require '../parser_extension'
|
||||
|
||||
module.exports = class ModParserExtensionV1 extends ParserExtension
|
||||
|
||||
constructor: (data)->
|
||||
super data, 'mod',
|
||||
author: @_command_author
|
||||
downloadUrl: @_command_downloadUrl
|
||||
homePageUrl: @_command_homePageUrl
|
||||
mod: @_command_mod
|
||||
|
||||
# Command Methods ##############################################################################
|
||||
|
||||
_command_author: (command)->
|
||||
return if @missingCurrent command, 'mod'
|
||||
|
||||
mod = @state.getCurrent 'mod'
|
||||
mod = @data.getCurrent 'mod'
|
||||
return if @duplicateField command, mod, 'author'
|
||||
return if @missingArgText command
|
||||
|
||||
@@ -25,7 +32,7 @@ module.exports = class ModParserExtensionV1 extends ParserExtension
|
||||
_command_downloadUrl: (command)->
|
||||
return if @missingCurrent command, 'mod'
|
||||
|
||||
mod = @state.getCurrent 'mod'
|
||||
mod = @data.getCurrent 'mod'
|
||||
return if @duplicateField command, mod, 'downloadUrl'
|
||||
return if @missingArgText command
|
||||
|
||||
@@ -34,7 +41,7 @@ module.exports = class ModParserExtensionV1 extends ParserExtension
|
||||
_command_homePageUrl: (command)->
|
||||
return if @missingCurrent command, 'mod'
|
||||
|
||||
mod = @state.getCurrent 'mod'
|
||||
mod = @data.getCurrent 'mod'
|
||||
return if @duplicateField command, mod, 'homePageUrl'
|
||||
return if @missingArgText command
|
||||
|
||||
@@ -44,4 +51,4 @@ module.exports = class ModParserExtensionV1 extends ParserExtension
|
||||
return if @missingArgText command
|
||||
return if @alreadyExists command, 'mod', command.argText
|
||||
|
||||
@state.create command, 'mod', command.argText
|
||||
@data.create command, 'mod', command.argText
|
||||
|
||||
@@ -6,50 +6,46 @@
|
||||
#
|
||||
|
||||
ModParserExtensionV1 = require './mod_pe_v1'
|
||||
ParserState = require '../parser_state'
|
||||
ParserData = require '../parser_data'
|
||||
|
||||
########################################################################################################################
|
||||
|
||||
parser = state = null
|
||||
parser = data = null
|
||||
|
||||
########################################################################################################################
|
||||
|
||||
describe 'mod_pe_v1.coffee', ->
|
||||
|
||||
beforeEach ->
|
||||
state = new ParserState
|
||||
parser = new ModParserExtensionV1 state
|
||||
data = new ParserData
|
||||
parser = new ModParserExtensionV1 data
|
||||
|
||||
state.create {}, 'mod', 0
|
||||
data.create {}, 'mod', 0
|
||||
|
||||
describe 'author', ->
|
||||
|
||||
it 'assigns to the current mod', ->
|
||||
parser.execute name:'author', argText:'alpha'
|
||||
.then ->
|
||||
state.getCurrent('mod').author.should.equal 'alpha'
|
||||
state.errors.should.eql []
|
||||
data.getCurrent('mod').author.should.equal 'alpha'
|
||||
data.errors.should.eql []
|
||||
|
||||
describe 'downloadUrl', ->
|
||||
|
||||
it 'assigns to the current mod', ->
|
||||
parser.execute name:'downloadUrl', argText:'alpha'
|
||||
.then ->
|
||||
state.getCurrent('mod').downloadUrl.should.equal 'alpha'
|
||||
state.errors.should.eql []
|
||||
data.getCurrent('mod').downloadUrl.should.equal 'alpha'
|
||||
data.errors.should.eql []
|
||||
|
||||
describe 'homePageUrl', ->
|
||||
|
||||
it 'assigns to the current mod', ->
|
||||
parser.execute name:'homePageUrl', argText:'alpha'
|
||||
.then ->
|
||||
state.getCurrent('mod').homePageUrl.should.equal 'alpha'
|
||||
state.errors.should.eql []
|
||||
data.getCurrent('mod').homePageUrl.should.equal 'alpha'
|
||||
data.errors.should.eql []
|
||||
|
||||
describe 'mod', ->
|
||||
|
||||
it 'creates a new mod', ->
|
||||
parser.execute name:'mod', argText:'alpha'
|
||||
.then ->
|
||||
mod = state.getCurrent 'mod'
|
||||
mod.id.should.equal 'alpha'
|
||||
mod = data.getCurrent 'mod'
|
||||
mod.id.should.equal 'alpha'
|
||||
|
||||
@@ -11,18 +11,23 @@ ParserExtension = require '../parser_extension'
|
||||
|
||||
module.exports = class ModVersionParserExtensionV1 extends ParserExtension
|
||||
|
||||
constructor: (data)->
|
||||
super data, 'modVersion',
|
||||
group: @_command_group
|
||||
version: @_command_version
|
||||
|
||||
# Command Methods ##############################################################################
|
||||
|
||||
_command_group: (command)->
|
||||
return if @missingArgText command
|
||||
return if @missingCurrent command, 'modVersion'
|
||||
|
||||
group = @state.create command, 'itemGroup', command.argText
|
||||
group.modVersion = @state.getCurrent 'modVersion'
|
||||
group = @data.create command, 'itemGroup', command.argText
|
||||
group.modVersion = @data.getCurrent 'modVersion'
|
||||
|
||||
_command_version: (command)->
|
||||
return if @missingArgText command
|
||||
return if @missingCurrent command, 'mod'
|
||||
|
||||
modVersion = @state.create command, 'modVersion', command.argText
|
||||
modVersion.mod = @state.getCurrent 'mod'
|
||||
modVersion = @data.create command, 'modVersion', command.argText
|
||||
modVersion.mod = @data.getCurrent 'mod'
|
||||
|
||||
@@ -6,38 +6,36 @@
|
||||
#
|
||||
|
||||
ModVersionParserExtensionV1 = require './mod_version_pe_v1'
|
||||
ParserState = require '../parser_state'
|
||||
ParserData = require '../parser_data'
|
||||
|
||||
########################################################################################################################
|
||||
|
||||
parser = state = null
|
||||
parser = data = null
|
||||
|
||||
########################################################################################################################
|
||||
|
||||
describe 'mod_version_pe_v1.coffee', ->
|
||||
|
||||
beforeEach ->
|
||||
state = new ParserState
|
||||
parser = new ModVersionParserExtensionV1 state
|
||||
data = new ParserData
|
||||
parser = new ModVersionParserExtensionV1 data
|
||||
|
||||
state.create {}, 'mod', 0
|
||||
data.create {}, 'mod', 0
|
||||
|
||||
describe 'group', ->
|
||||
|
||||
it 'creates a new item group', ->
|
||||
state.create {}, 'modVersion', 1
|
||||
data.create {}, 'modVersion', 1
|
||||
|
||||
parser.execute name:'group', argText:'alpha'
|
||||
.then ->
|
||||
itemGroup = state.getCurrent('itemGroup')
|
||||
itemGroup.id.should.equal 'alpha'
|
||||
itemGroup.modVersion.id.should.equal 1
|
||||
itemGroup = data.getCurrent('itemGroup')
|
||||
itemGroup.id.should.equal 'alpha'
|
||||
itemGroup.modVersion.id.should.equal 1
|
||||
|
||||
describe 'version', ->
|
||||
|
||||
it 'creates a new mod version', ->
|
||||
parser.execute name:'version', argText:'alpha'
|
||||
.then ->
|
||||
modVersion = state.getCurrent 'modVersion'
|
||||
modVersion.id.should.equal 'alpha'
|
||||
modVersion.mod.id.should.equal 0
|
||||
modVersion = data.getCurrent 'modVersion'
|
||||
modVersion.id.should.equal 'alpha'
|
||||
modVersion.mod.id.should.equal 0
|
||||
|
||||
@@ -11,6 +11,17 @@ ParserExtension = require '../parser_extension'
|
||||
|
||||
module.exports = class RecipeParserExtensionV1 extends ParserExtension
|
||||
|
||||
constructor: (data)->
|
||||
super data, 'recipe',
|
||||
extras: @_command_extras
|
||||
input: @_command_input
|
||||
pattern: @_command_pattern
|
||||
recipe: @_command_recipe
|
||||
quantity: @_command_quantity
|
||||
tools: @_command_tools
|
||||
|
||||
# Class Methods ################################################################################
|
||||
|
||||
@::PATTERN = /[0-9. ]+/
|
||||
|
||||
@::STACK = /^([0-9]+) +(.+)$/
|
||||
@@ -20,7 +31,7 @@ module.exports = class RecipeParserExtensionV1 extends ParserExtension
|
||||
invalidPattern: (command)->
|
||||
match = command.argText.match @PATTERN
|
||||
if not match?
|
||||
@state.addError command, "invalid pattern: \"#{command.argText}\""
|
||||
@data.addError command, "invalid pattern: \"#{command.argText}\""
|
||||
return true
|
||||
|
||||
return false
|
||||
@@ -31,7 +42,7 @@ module.exports = class RecipeParserExtensionV1 extends ParserExtension
|
||||
return if @missingCurrent command, 'recipe'
|
||||
return if @missingArgs command
|
||||
|
||||
recipe = @state.getCurrent 'recipe'
|
||||
recipe = @data.getCurrent 'recipe'
|
||||
return if @duplicateField command, 'extras', recipe
|
||||
|
||||
recipe.extras = command.args
|
||||
@@ -40,7 +51,7 @@ module.exports = class RecipeParserExtensionV1 extends ParserExtension
|
||||
return if @missingCurrent command, 'recipe'
|
||||
return if @missingArgs command
|
||||
|
||||
recipe = @state.getCurrent 'recipe'
|
||||
recipe = @data.getCurrent 'recipe'
|
||||
return if @duplicateField command, 'input', recipe
|
||||
|
||||
recipe.input = (@_parseStack(arg) for arg in command.args)
|
||||
@@ -50,7 +61,7 @@ module.exports = class RecipeParserExtensionV1 extends ParserExtension
|
||||
return if @missingArgText command
|
||||
return if @invalidPattern command
|
||||
|
||||
recipe = @state.getCurrent 'recipe'
|
||||
recipe = @data.getCurrent 'recipe'
|
||||
return if @duplicateField command, 'pattern', recipe
|
||||
|
||||
recipe.pattern = command.argText
|
||||
@@ -58,8 +69,8 @@ module.exports = class RecipeParserExtensionV1 extends ParserExtension
|
||||
_command_recipe: (command)->
|
||||
return if @missingCurrent command, 'item'
|
||||
|
||||
recipe = @state.create command, 'recipe'
|
||||
recipe.item = @state.getCurrent 'item'
|
||||
recipe = @data.create command, 'recipe'
|
||||
recipe.item = @data.getCurrent 'item'
|
||||
|
||||
_command_quantity: (command)->
|
||||
return if @missingCurrent command, 'recipe'
|
||||
@@ -68,7 +79,7 @@ module.exports = class RecipeParserExtensionV1 extends ParserExtension
|
||||
value = @parseInt command, command.argText
|
||||
return unless value?
|
||||
|
||||
recipe = @state.getCurrent 'recipe'
|
||||
recipe = @data.getCurrent 'recipe'
|
||||
return if @duplicateField command, 'quantity', recipe
|
||||
|
||||
recipe.quantity = value
|
||||
@@ -77,7 +88,7 @@ module.exports = class RecipeParserExtensionV1 extends ParserExtension
|
||||
return if @missingCurrent command, 'recipe'
|
||||
return if @missingArgs command
|
||||
|
||||
recipe = @state.getCurrent 'recipe'
|
||||
recipe = @data.getCurrent 'recipe'
|
||||
return if @duplicateField command, 'tools', recipe
|
||||
|
||||
recipe.tools = (@_parseStack(arg) for arg in command.args)
|
||||
|
||||
@@ -6,109 +6,100 @@
|
||||
#
|
||||
|
||||
RecipeParserExtensionV1 = require './recipe_pe_v1'
|
||||
ParserState = require '../parser_state'
|
||||
ParserData = require '../parser_data'
|
||||
|
||||
########################################################################################################################
|
||||
|
||||
parser = state = null
|
||||
parser = data = null
|
||||
|
||||
########################################################################################################################
|
||||
|
||||
describe 'recipe_pe_v1.coffee', ->
|
||||
|
||||
beforeEach ->
|
||||
state = new ParserState
|
||||
parser = new RecipeParserExtensionV1 state
|
||||
data = new ParserData
|
||||
parser = new RecipeParserExtensionV1 data
|
||||
|
||||
state.create {}, 'item', 0
|
||||
data.create {}, 'item', 0
|
||||
|
||||
describe 'extras', ->
|
||||
|
||||
it 'assigns to the current recipe', ->
|
||||
state.create {}, 'recipe'
|
||||
data.create {}, 'recipe'
|
||||
|
||||
parser.execute name:'extras', args:['bravo']
|
||||
.then ->
|
||||
recipe = state.getCurrent 'recipe'
|
||||
recipe.extras.should.eql ['bravo']
|
||||
state.errors.should.eql []
|
||||
recipe = data.getCurrent 'recipe'
|
||||
recipe.extras.should.eql ['bravo']
|
||||
data.errors.should.eql []
|
||||
|
||||
describe 'input', ->
|
||||
|
||||
it 'correctly reads a single item', ->
|
||||
state.create {}, 'recipe'
|
||||
data.create {}, 'recipe'
|
||||
|
||||
parser.execute name:'input', args:['bravo']
|
||||
.then ->
|
||||
recipe = state.getCurrent 'recipe'
|
||||
recipe.input.should.eql [name:'bravo', quantity:1]
|
||||
state.errors.should.eql []
|
||||
recipe = data.getCurrent 'recipe'
|
||||
recipe.input.should.eql [name:'bravo', quantity:1]
|
||||
data.errors.should.eql []
|
||||
|
||||
it 'correctly reads multiple items', ->
|
||||
state.create {}, 'recipe'
|
||||
data.create {}, 'recipe'
|
||||
|
||||
parser.execute name:'input', args:['bravo', 'charlie']
|
||||
.then ->
|
||||
recipe = state.getCurrent 'recipe'
|
||||
recipe.input.should.eql [{name:'bravo', quantity:1}, {name:'charlie', quantity:1}]
|
||||
state.errors.should.eql []
|
||||
recipe = data.getCurrent 'recipe'
|
||||
recipe.input.should.eql [{name:'bravo', quantity:1}, {name:'charlie', quantity:1}]
|
||||
data.errors.should.eql []
|
||||
|
||||
it 'correctly reads a stack', ->
|
||||
state.create {}, 'recipe'
|
||||
data.create {}, 'recipe'
|
||||
|
||||
parser.execute name:'input', args:['10 bravo']
|
||||
.then ->
|
||||
recipe = state.getCurrent 'recipe'
|
||||
recipe.input.should.eql [name:'bravo', quantity:10]
|
||||
state.errors.should.eql []
|
||||
recipe = data.getCurrent 'recipe'
|
||||
recipe.input.should.eql [name:'bravo', quantity:10]
|
||||
data.errors.should.eql []
|
||||
|
||||
describe 'pattern', ->
|
||||
|
||||
it 'assigns to the current recipe', ->
|
||||
state.create {}, 'recipe'
|
||||
data.create {}, 'recipe'
|
||||
|
||||
parser.execute name:'pattern', argText:'00. 00. ...'
|
||||
.then ->
|
||||
recipe = state.getCurrent 'recipe'
|
||||
recipe.pattern.should.equal '00. 00. ...'
|
||||
state.errors.should.eql []
|
||||
recipe = data.getCurrent 'recipe'
|
||||
recipe.pattern.should.equal '00. 00. ...'
|
||||
data.errors.should.eql []
|
||||
|
||||
it 'rejects an invalid pattern', ->
|
||||
state.create {}, 'recipe'
|
||||
data.create {}, 'recipe'
|
||||
|
||||
parser.execute name:'pattern', argText:'alpha'
|
||||
.then ->
|
||||
recipe = state.getCurrent 'recipe'
|
||||
expect(recipe.pattern).to.be.undefined
|
||||
(e.message for e in state.errors).should.eql ['invalid pattern: "alpha"']
|
||||
recipe = data.getCurrent 'recipe'
|
||||
expect(recipe.pattern).to.be.undefined
|
||||
(e.message for e in data.errors).should.eql ['invalid pattern: "alpha"']
|
||||
|
||||
describe 'recipe', ->
|
||||
|
||||
it 'creates a new recipe', ->
|
||||
parser.execute name:'recipe'
|
||||
.then ->
|
||||
recipe = state.getCurrent 'recipe'
|
||||
recipe.item.id.should.equal 0
|
||||
state.errors.should.eql []
|
||||
recipe = data.getCurrent 'recipe'
|
||||
recipe.item.id.should.equal 0
|
||||
data.errors.should.eql []
|
||||
|
||||
describe 'quantity', ->
|
||||
|
||||
it 'assigns to the current recipe', ->
|
||||
state.create {}, 'recipe'
|
||||
data.create {}, 'recipe'
|
||||
|
||||
parser.execute name:'quantity', argText:'42'
|
||||
.then ->
|
||||
recipe = state.getCurrent 'recipe'
|
||||
recipe.quantity.should.equal 42
|
||||
state.errors.should.eql []
|
||||
recipe = data.getCurrent 'recipe'
|
||||
recipe.quantity.should.equal 42
|
||||
data.errors.should.eql []
|
||||
|
||||
describe 'tools', ->
|
||||
|
||||
it 'assigns to the current recipe', ->
|
||||
state.create {}, 'recipe'
|
||||
data.create {}, 'recipe'
|
||||
|
||||
parser.execute name:'tools', args:['bravo']
|
||||
.then ->
|
||||
recipe = state.getCurrent 'recipe'
|
||||
recipe.tools.should.eql [name:'bravo', quantity:1]
|
||||
state.errors.should.eql []
|
||||
recipe = data.getCurrent 'recipe'
|
||||
recipe.tools.should.eql [name:'bravo', quantity:1]
|
||||
data.errors.should.eql []
|
||||
|
||||
Reference in New Issue
Block a user