/
LinuxWifiConfigurationCapability_spec.js
50 lines (35 loc) · 1.94 KB
/
LinuxWifiConfigurationCapability_spec.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
48
49
50
const fs = require("fs");
const path = require("path");
const should = require("should");
const LinuxWifiConfigurationCapability = require("../../../../../lib/robots/common/linuxCapabilities/LinuxWifiConfigurationCapability");
should.config.checkProtoEql = false;
describe("LinuxWifiConfigurationCapability", function () {
let capability;
beforeEach(function () {
capability = new LinuxWifiConfigurationCapability({robot: undefined});
});
it("Should parse iw connected output correctly", async function() {
let data = fs.readFileSync(path.join(__dirname, "/res/iw_3.4_connected.txt")).toString();
let expected = JSON.parse(fs.readFileSync(path.join(__dirname, "/res/iw_3.4_connected.json")).toString());
let actual = capability.parseIwStdout(data);
actual.should.deepEqual(expected);
});
it("Should parse iw connected with counters correctly", async function() {
let data = fs.readFileSync(path.join(__dirname, "/res/iw_3.4_connected_with_counters.txt")).toString();
let expected = JSON.parse(fs.readFileSync(path.join(__dirname, "/res/iw_3.4_connected_with_counters.json")).toString());
let actual = capability.parseIwStdout(data);
actual.should.deepEqual(expected);
});
it("Should parse iw not connected output correctly", async function() {
let data = fs.readFileSync(path.join(__dirname, "/res/iw_3.4_not_connected.txt")).toString();
let expected = JSON.parse(fs.readFileSync(path.join(__dirname, "/res/iw_3.4_not_connected.json")).toString());
let actual = capability.parseIwStdout(data);
actual.should.deepEqual(expected);
});
it("Should parse no output correctly", async function() {
let data = "";
let expected = JSON.parse(fs.readFileSync(path.join(__dirname, "/res/no_output.json")).toString());
let actual = capability.parseIwStdout(data);
actual.should.deepEqual(expected);
});
});