|
| 1 | +/* |
| 2 | + * Copyright 2018 IBM Corporation |
| 3 | + * |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | + * you may not use this file except in compliance with the License. |
| 6 | + * You may obtain a copy of the License at |
| 7 | + * |
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | + * |
| 10 | + * Unless required by applicable law or agreed to in writing, software |
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | + * See the License for the specific language governing permissions and |
| 14 | + * limitations under the License. |
| 15 | + */ |
| 16 | + |
| 17 | +const common = require('../../../lib/common'), |
| 18 | + openwhisk = require('../../../lib/openwhisk'), |
| 19 | + ui = require('../../../lib/ui'), |
| 20 | + assert = require('assert'), |
| 21 | + keys = ui.keys, |
| 22 | + cli = ui.cli, |
| 23 | + sidecar = ui.sidecar |
| 24 | + |
| 25 | +describe('shell commands', function() { |
| 26 | + before(common.before(this)) |
| 27 | + after(common.after(this)) |
| 28 | + |
| 29 | + it('should have an active repl', () => cli.waitForRepl(this.app)) |
| 30 | + |
| 31 | + it('should echo hi', () => cli.do(`! echo hi`, this.app) |
| 32 | + .then(cli.expectOKWithCustom({ expect: 'hi' })) |
| 33 | + .catch(common.oops(this))) |
| 34 | + |
| 35 | + it('should echo ho to a file', () => cli.do(`! echo ho > /tmp/testTmp`, this.app) |
| 36 | + .then(cli.expectOK) |
| 37 | + .catch(common.oops(this))) |
| 38 | + |
| 39 | + it('should cat that file', () => cli.do(`! cat /tmp/testTmp`, this.app) |
| 40 | + .then(cli.expectOKWithCustom({ expect: 'ho' })) |
| 41 | + .catch(common.oops(this))) |
| 42 | + |
| 43 | + it('should cat that file', () => cli.do(`! cd data`, this.app) |
| 44 | + .then(cli.expectOK) |
| 45 | + .catch(common.oops(this))) |
| 46 | + |
| 47 | + it('should list commandFile.wsk', () => cli.do(`lls`, this.app) |
| 48 | + .then(cli.expectOKWithCustom({ expect: 'commandFile.wsk' })) |
| 49 | + .catch(common.oops(this))) |
| 50 | +}) |
0 commit comments