Skip to content
This repository was archived by the owner on Mar 30, 2021. It is now read-only.

Commit b717eeb

Browse files
committed
Adds more tests for importing from npm
1 parent 2a3caff commit b717eeb

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

__tests__/app.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,26 @@ describe("generator-biojs-webcomponents:app - Upgrade an existing component by i
157157
});
158158
});
159159

160+
describe("generator-biojs-webcomponents:app - Upgrade an existing component by installing component from npm package", () => {
161+
it("installs the latest component from its npm package if user enters a valid version", async () => {
162+
let res = await validators.checkVersionAndInstallComponent("latest", {
163+
packageNameToInstallComponent: "http-server"
164+
});
165+
assert.equal(res, true);
166+
});
167+
});
168+
160169
describe("generator-biojs-webcomponents:app - Upgrade an existing component by importing build file using npm", () => {
170+
it("runs the generator in the directory passed in arguments", async () => {
171+
await validators.storeArg("test-component").then(() => {
172+
assert.file("test-component");
173+
});
174+
});
175+
it("makes a new directory named - component-dist", async () => {
176+
await validators
177+
.directoryName("component-dist")
178+
.then(() => assert.file(["test-component/component-dist"]));
179+
});
161180
it("throws an error if version entered does not exist", async () => {
162181
assert.equal(
163182
await validators.version("fkdk", { packageName: "node" }),
@@ -170,6 +189,15 @@ describe("generator-biojs-webcomponents:app - Upgrade an existing component by i
170189
)
171190
);
172191
});
192+
it("downloads the URL of build file entered is correct", async () => {
193+
await validators
194+
.importBuildFileFromNPM(
195+
"https://cdn.jsdelivr.net/npm/[email protected]/index.min.js"
196+
)
197+
.then(() => {
198+
assert.file("test-component/component-dist/index.min.js");
199+
});
200+
});
173201
it("throws an error if an npm package doesn't exist", async () => {
174202
assert.equal(
175203
await validators.packageName("cbaxyz"),

0 commit comments

Comments
 (0)