-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move node list generation tests into new file
- Loading branch information
1 parent
1056872
commit 91b26e3
Showing
2 changed files
with
118 additions
and
117 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
var assert = require("chai").assert | ||
var nodeListTransform = require("../www/js/nodeListTransform.js") | ||
|
||
describe("Wifi Analyzer alias list", function () { | ||
it("should list a simple node", function () { | ||
var result = nodeListTransform({ | ||
nodes: { | ||
c423523487: { | ||
nodeinfo: { | ||
hostname: "host-one", | ||
network: { | ||
mesh: { | ||
bat0: { | ||
interfaces: { | ||
wireless: ["99:ee:ee:ee:01:01"] | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}); | ||
assert.include(result, "99:ee:ee:ee:01:01|host-one (99:ee:ee:ee:01:01)"); | ||
}); | ||
|
||
it("should filter out nodes without hostname", function () { | ||
var result = nodeListTransform({ | ||
nodes: { | ||
c423523487: { | ||
nodeinfo: { | ||
network: { | ||
mesh: { | ||
bat0: { | ||
interfaces: { | ||
wireless: ["99:ee:ee:ee:01:01"] | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}); | ||
assert.notInclude(result.join(), "undefined"); | ||
}); | ||
|
||
it("should filter out nodes without interfaces", function () { | ||
var result = nodeListTransform({ | ||
nodes: { | ||
c423523487: { | ||
nodeinfo: { | ||
hostname: "host-one", | ||
network: { | ||
mesh: { | ||
bat0: {} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}); | ||
|
||
assert.notInclude(result.join(), "undefined"); | ||
}); | ||
|
||
it("should list a node with multiple macs", function () { | ||
var result = nodeListTransform({ | ||
nodes: { | ||
c423523487: { | ||
nodeinfo: { | ||
hostname: "host-one", | ||
network: { | ||
mesh: { | ||
bat0: { | ||
interfaces: { | ||
wireless: [ | ||
"99:ee:ee:ee:01:01", | ||
"11:ee:ee:ee:01:01" | ||
] | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}); | ||
|
||
assert.include(result, "99:ee:ee:ee:01:01|host-one (99:ee:ee:ee:01:01)"); | ||
assert.include(result, "11:ee:ee:ee:01:01|host-one (11:ee:ee:ee:01:01)"); | ||
}); | ||
|
||
it("should add the next and previous mac", function () { | ||
var result = nodeListTransform({ | ||
nodes: { | ||
c423523487: { | ||
nodeinfo: { | ||
hostname: "host-one", | ||
network: { | ||
mesh: { | ||
bat0: { | ||
interfaces: { | ||
wireless: ["99:ee:ee:ee:01:01"] | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}); | ||
|
||
assert.include(result, "99:ee:ee:ee:01:01|host-one (99:ee:ee:ee:01:01)"); | ||
assert.include(result, "99:ef:ee:ee:01:01|host-one (99:ef:ee:ee:01:01)"); | ||
assert.include(result, "99:ed:ee:ee:01:01|host-one (99:ed:ee:ee:01:01)"); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters