Skip to content

Commit

Permalink
test(integration): add integration test for set type (#58)
Browse files Browse the repository at this point in the history
resolves #51
  • Loading branch information
wizzy25 authored Mar 21, 2017
1 parent 4953e36 commit ec30731
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/spec/helper-customTypePayload.spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,16 @@ baseObj = {
"required": false,
"label": { "en": "name" },
"inputHint": "SingleLine"
},
{
"name": "sizes",
"type": {
"name": "Set",
"elementType": { "name": "String" }
},
"required": false,
"label": { "en": "sizes" },
"inputHint": "SingleLine"
}
]
}
Expand Down
22 changes: 22 additions & 0 deletions src/spec/integration.spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,28 @@ describe 'integration test', ->
done(err)
, 10000 # 10sec

it 'CSV - should accept set types', (done) ->
raw =
"""
sku,quantityOnStock,restockableInDays,expectedDelivery,customType,customField.quantityFactor,customField.color,customField.localizedString.de,customField.localizedString.en,customField.sizes
another2,77,12,2001-09-11T14:00:00.000Z,my-type,9,nac,Schneidder,Abi,"Medium,Extra Large"
"""
@stockimport.run(raw, 'CSV')
.then =>
@stockimport.summaryReport()
.then (message) =>
expect(message).toBe 'Summary: there were 1 imported stocks (1 were new and 0 were updates)'
@client.inventoryEntries.fetch()
.then (result) =>
stocks = result.body.results
expect(_.size stocks).toBe 1
expect(stocks[0]).toBeDefined()
expect(stocks[0].custom.fields.sizes.constructor).toEqual Array
expect(stocks[0].custom.fields.sizes).toEqual [ 'Medium', 'Extra Large' ]
done()
.catch (err) -> done(err)
, 10000 # 10sec

it 'CSV - API should return error if required header is missing', (done) ->
raw =
"""
Expand Down

0 comments on commit ec30731

Please sign in to comment.