Skip to content

Commit

Permalink
make view e2e
Browse files Browse the repository at this point in the history
  • Loading branch information
ComradeVanti committed Aug 21, 2024
1 parent 4f6dafd commit 9147877
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 118 deletions.
53 changes: 53 additions & 0 deletions test/e2e/view.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import { ResultCodes } from "../../src/cli/result-codes";
import { runOpenupm } from "./run";
import { prepareHomeDirectory } from "./setup/directories";

describe("view packages", () => {
it("should fail if package version was specified", async () => {
const homeDir = await prepareHomeDirectory();

const output = await runOpenupm(homeDir, [
"view",
"dev.comradevanti.opt-unity@2.0.0",
]);

expect(output.code).toEqual(ResultCodes.Error);
expect(output.stdErr).toEqual(
expect.arrayContaining([
expect.stringContaining("please do not specify a version"),
])
);
});

it("should fail if package is not found", async () => {
const homeDir = await prepareHomeDirectory();

const output = await runOpenupm(homeDir, [
"view",
"not.existent.package.123456",
]);

expect(output.code).toEqual(ResultCodes.Error);
expect(output.stdErr).toEqual(
expect.arrayContaining([expect.stringContaining("could not be found")])
);
});

it("should print package information", async () => {
const homeDir = await prepareHomeDirectory();

const output = await runOpenupm(homeDir, [
"view",
"dev.comradevanti.opt-unity",
]);

expect(output.code).toEqual(ResultCodes.Ok);
expect(output.stdOut).toEqual(
expect.arrayContaining([
expect.stringContaining(
"dev.comradevanti.opt-unity@3.5.0 | Unlicense | versions: 10"
),
])
);
});
});
118 changes: 0 additions & 118 deletions test/unit/cli/cmd-view.test.ts

This file was deleted.

0 comments on commit 9147877

Please sign in to comment.