UNPKG

1.09 kBtext/coffeescriptView Raw
1streams = require './streams'
2
3describe 'import', ->
4
5 es = stdin = stdout = stderr = cmd = null
6
7 beforeEach ->
8 {es} = require('./mock-all')()
9 stdin = streams.bulk()
10 stdout = streams.output()
11 stderr = streams.output()
12 cmd = require('../src/cmd')(stdin, stdout, stderr)
13
14 afterEach ->
15 mock.stopAll()
16
17 describe 'with -d', ->
18 it 'turns import to delete', ->
19 cmd ['import', '-d', 'http://localhost:9200']
20 streams.promise(stdin).then ->
21 assert.deepEqual es().bulk.args[0][0], body:[
22 {
23 delete:
24 _id: '0ea74996-f3f9-5a88-ba19-f5ea93afa833'
25 _index: 'myindex'
26 _type: 'mytype'
27 }
28 {
29 delete:
30 _id: '7303e089-1b8f-5556-b427-8189d17d993a'
31 _index: 'myindex'
32 _type: 'mytype'
33 }
34 ]