Skip to content

Commit

Permalink
test(generator): Add test for isSearchable issue #46
Browse files Browse the repository at this point in the history
  • Loading branch information
junajan committed Nov 21, 2016
1 parent ec29a81 commit 22de4bf
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions src/spec/unit/product-type-generator.spec.coffee
Expand Up @@ -769,6 +769,53 @@ describe 'ProductTypeGenerator', ->

expect(@generator._createAttributeDefinitions([attributeRow])).to.deep.equal expectedAttributeDefinition

it 'should return an attribute definition of type set:lenum', ->

attributeRow =
name: '60048507_einschubfuer',
type: 'set:lenum',
attributeConstraint: 'None',
isRequired: 'false',
isSearchable: 'true',
enumKey: '60048507_einschubfuer_ep60059811',
'enumLabel.nl': 'MM-Card',
'enumLabel.it': 'MM-Card',
'enumLabel.fr': 'MMC',
'enumLabel.de': 'MM-Card',
'type.referenceTypeId': '',
'type.typeReference.typeId': '',
'type.typeReference.id': '',
'label.en': '',
'label.nl': 'geïntegreerde deel voor',
'label.it': 'Slot integrata per',
'label.fr': 'Slot intégré pour carte(s):',
'label.de': 'Einschub für',
textInputHint: 'SingleLine',
displayGroup: 'Other'

expectedAttributeDefinition =
'60048507_einschubfuer':
name: '60048507_einschubfuer',
label:
nl: 'geïntegreerde deel voor',
it: 'Slot integrata per',
fr: 'Slot intégré pour carte(s):',
de: 'Einschub für',
type:
name: 'set',
elementType:
name: 'lenum',
values:
[
key: '60048507_einschubfuer_ep60059811',
label: { nl: 'MM-Card', it: 'MM-Card', fr: 'MMC', de: 'MM-Card' }
]
attributeConstraint: 'None',
isRequired: false,
isSearchable: true

expect(@generator._createAttributeDefinitions([attributeRow])).to.deep.equal expectedAttributeDefinition

it 'should split and return attribute element type or ettribute type', ->

expect(@generator._typeOrElementType('set:set:type')).to.deep.equal 'set:type'
Expand Down

0 comments on commit 22de4bf

Please sign in to comment.