ssh-client-wrapper 2.2.4 → 2.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -47,34 +47,33 @@ const nonExisting = "ARSSH_nonExisting";
47
47
  /*
48
48
  * prepare local files which contain its filename
49
49
  */
50
- async function createLocalFiles() {
50
+ async function createLocalFiles () {
51
51
  const localDir2 = path.join(localRoot, "hoge");
52
52
  const promises = [];
53
53
  await fs.mkdir(localRoot);
54
54
  await fs.mkdir(localDir2);
55
55
  promises.push(fs.mkdir(localEmptyDir));
56
- localFiles.forEach((localFile)=>{
56
+ localFiles.forEach((localFile) => {
57
57
  promises.push(fs.writeFile(localFile, `${localFile}\n`));
58
58
  });
59
59
  return Promise.all(promises);
60
60
  }
61
61
 
62
-
63
- async function clearLocalTestFiles() {
62
+ async function clearLocalTestFiles () {
64
63
  return fs.remove(localRoot);
65
64
  }
66
65
 
67
- async function createRemoteFiles(hostInfo) {
68
- //create remote files
66
+ async function createRemoteFiles (hostInfo) {
67
+ // create remote files
69
68
  await sshExec(hostInfo, `mkdir -p ${remoteRoot}/hoge`);
70
69
  await sshExec(hostInfo, `mkdir -p ${remoteEmptyDir}`);
71
- const script = remoteFiles.reduce((a, remoteFile)=>{
70
+ const script = remoteFiles.reduce((a, remoteFile) => {
72
71
  return `${a}echo ${remoteFile} > ${remoteFile};`;
73
72
  }, "");
74
73
  return sshExec(hostInfo, `${script}`);
75
74
  }
76
75
 
77
- async function clearRemoteTestFiles(hostInfo) {
76
+ async function clearRemoteTestFiles (hostInfo) {
78
77
  return sshExec(hostInfo, `rm -fr ${remoteRoot}`);
79
78
  }
80
79
 
package/test/util.js CHANGED
@@ -1,30 +1,29 @@
1
1
  "use strict";
2
- process.on("unhandledRejection", console.dir); //eslint-disable-line no-console
2
+ process.on("unhandledRejection", console.dir); // eslint-disable-line no-console
3
3
 
4
- //setup test framework
4
+ // setup test framework
5
5
  const chai = require("chai");
6
6
  const { expect } = require("chai");
7
7
  chai.use(require("chai-as-promised"));
8
8
 
9
-
10
- //testee
9
+ // testee
11
10
  const { sanityCheck } = require("../lib/util.js");
12
11
 
13
- describe("test for sanityCheck", ()=>{
12
+ describe("test for sanityCheck", () => {
14
13
  const host = "testHostName";
15
- it("should throw error for empty host", ()=>{
14
+ it("should throw error for empty host", () => {
16
15
  expect(sanityCheck.bind(null, { host: " ", user: " ", port: 22 })).to.throw(/empty host is not allowed/);
17
16
  });
18
- it("should throw error if host is not in argument object", ()=>{
17
+ it("should throw error if host is not in argument object", () => {
19
18
  expect(sanityCheck.bind(null, { user: " ", port: 22 })).to.throw(/host is required/);
20
19
  });
21
- it("should just remove empty string props", ()=>{
20
+ it("should just remove empty string props", () => {
22
21
  expect(sanityCheck({ host, user: " ", port: 22 })).to.deep.equal({ host, port: 22 });
23
22
  });
24
- it("should remove empty string member in sshOpt", ()=>{
23
+ it("should remove empty string member in sshOpt", () => {
25
24
  expect(sanityCheck({ host, sshOpt: ["foo", " ", "bar"], user: "user", port: 33 })).to.deep.equal({ host, sshOpt: ["foo", "bar"], user: "user", port: 33 });
26
25
  });
27
- it("should just chage type if string value specified for number", ()=>{
26
+ it("should just chage type if string value specified for number", () => {
28
27
  expect(sanityCheck({
29
28
  host,
30
29
  port: "11",
@@ -43,7 +42,7 @@ describe("test for sanityCheck", ()=>{
43
42
  retryMaxTimeout: 66
44
43
  });
45
44
  });
46
- it("should remove out of range members", ()=>{
45
+ it("should remove out of range members", () => {
47
46
  expect(sanityCheck({
48
47
  host,
49
48
  ControlPersist: "-1",
@@ -55,7 +54,7 @@ describe("test for sanityCheck", ()=>{
55
54
  host
56
55
  });
57
56
  });
58
- it("should just chage type if string value specified for boolean member", ()=>{
57
+ it("should just chage type if string value specified for boolean member", () => {
59
58
  expect(sanityCheck({
60
59
  host,
61
60
  noStrictHostkeyChecking: "true"
@@ -64,7 +63,7 @@ describe("test for sanityCheck", ()=>{
64
63
  noStrictHostkeyChecking: true
65
64
  });
66
65
  });
67
- it("should just chage type if number value specified for boolean member", ()=>{
66
+ it("should just chage type if number value specified for boolean member", () => {
68
67
  expect(sanityCheck({
69
68
  host,
70
69
  noStrictHostkeyChecking: 0