Skip to content

Commit

Permalink
Add spec for issue #20.
Browse files Browse the repository at this point in the history
  • Loading branch information
hajoeichler committed Jun 26, 2014
1 parent dcc090e commit 3ee3c69
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/spec/stockimport.spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ describe 'StockImport', ->
expect(s.quantityOnStock).toBe -3
done()

it 'shoud not crash when quantity or index is missing', (done) ->
it 'shoud not crash when quantity is missing', (done) ->
rawCSV =
'''
foo,id,amount
Expand All @@ -147,7 +147,6 @@ describe 'StockImport', ->
'''
Csv().from.string(rawCSV).to.array (data, count) =>
stocks = @import._mapStockFromCSV _.rest(data), 1, 2
console.log "HAJO", stocks
expect(_.size stocks).toBe 2
s = stocks[0]
expect(s.sku).toBe 'abc'
Expand All @@ -157,6 +156,17 @@ describe 'StockImport', ->
expect(s.quantityOnStock).toBe 77
done()

xit 'shoud not crash when quantity is missing', (done) ->
rawCSV =
'''
foo,id,amount
bar
'''
Csv().from.string(rawCSV).to.array (data, count) =>
stocks = @import._mapStockFromCSV _.rest(data), 1, 2
expect(_.size stocks).toBe 0
done()


describe '#performCSV', ->

Expand Down

0 comments on commit 3ee3c69

Please sign in to comment.