2019-06-11 22:24:35 +00:00
|
|
|
require "helper"
|
|
|
|
require "inspec/resource"
|
|
|
|
require "inspec/resources/npm"
|
2015-09-08 22:12:25 +00:00
|
|
|
|
2019-06-11 22:24:35 +00:00
|
|
|
describe "Inspec::Resources::Npm" do
|
|
|
|
it "verify npm package detail parsing" do
|
|
|
|
resource = load_resource("npm", "bower")
|
2015-09-22 16:33:05 +00:00
|
|
|
pkg = {
|
2019-06-11 22:24:35 +00:00
|
|
|
name: "bower",
|
|
|
|
version: "1.4.1",
|
|
|
|
type: "npm",
|
2015-09-22 16:33:05 +00:00
|
|
|
installed: true,
|
|
|
|
}
|
|
|
|
_(resource.installed?).must_equal true
|
|
|
|
_(resource.info).must_equal pkg
|
2015-09-08 22:12:25 +00:00
|
|
|
end
|
2018-06-01 08:52:46 +00:00
|
|
|
|
2019-06-11 22:24:35 +00:00
|
|
|
it "verify npm package in local folder" do
|
|
|
|
resource = load_resource("npm", "bower", path: "/path/to/project")
|
2018-06-01 08:52:46 +00:00
|
|
|
pkg = {
|
2019-06-11 22:24:35 +00:00
|
|
|
name: "bower",
|
|
|
|
version: "1.4.2",
|
|
|
|
type: "npm",
|
2018-06-01 08:52:46 +00:00
|
|
|
installed: true,
|
|
|
|
}
|
|
|
|
_(resource.installed?).must_equal true
|
|
|
|
_(resource.info).must_equal pkg
|
|
|
|
end
|
2022-06-02 11:32:39 +00:00
|
|
|
|
|
|
|
it "generates resource_id for the current resource" do
|
|
|
|
resource = load_resource("npm", "bower", path: "/path/to/project")
|
|
|
|
_(resource.resource_id).must_equal("bower")
|
|
|
|
end
|
2015-09-08 22:12:25 +00:00
|
|
|
end
|