/
jar.js
47 lines (42 loc) · 1.8 KB
/
jar.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/*
* Copyright 2018 IBM Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
const common = require('../../../lib/common'),
openwhisk = require('../../../lib/openwhisk'),
ui = require('../../../lib/ui'),
assert = require('assert'),
keys = ui.keys,
cli = ui.cli,
sidecar = ui.sidecar,
actionName1 = 'foo1'
describe('Create jar actions', function() {
before(common.before(this))
after(common.after(this))
it('should have an active repl', () => cli.waitForRepl(this.app))
it('should create a jar action', () => cli.do(`action create ${actionName1} ./data/jar/echo.jar --main echo`, this.app)
.then(cli.expectOK)
.then(sidecar.expectOpen)
.then(sidecar.expectShowing(actionName1))
.then(sidecar.expectBadge('jar'))
.then(app => app.client.getText(`${ui.selectors.SIDECAR_CONTENT} .hook-for-third-party-content`))
.then(code => assert.equal(code, 'This is machine-generated code, wrapping around your original code.'))
.catch(common.oops(this)))
it('should invoke the jar action', () => cli.do(`invoke -p x 3`, this.app)
.then(cli.expectOK)
.then(sidecar.expectOpen)
.then(sidecar.expectShowing(actionName1))
.then(sidecar.expectResult({x: 3}))
.catch(common.oops(this)))
})