Skip to content
This repository was archived by the owner on Feb 6, 2024. It is now read-only.
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 16 additions & 16 deletions internal/integration-test/src/pip.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as pip from "@actions-kit/pip";
import { afterAll, beforeAll, describe, expect, test } from "@jest/globals";
import { afterAll, beforeAll, describe, expect, it } from "@jest/globals";
import * as fs from "fs";
import { repeat } from "./helper.test";

Expand All @@ -9,23 +9,23 @@ describe("Pip package installation and uninstallation (rsa)", () => {
}, 3 * 10000);

describe("Installing the rsa package", () => {
test("should show the package info as undefined", () => {
it("should show the package info as undefined", () => {
const promise = pip.showPackageInfo("rsa");
return expect(promise).resolves.toBeUndefined();
});

// prettier-ignore
test("should install the package successfully", () => {
it("should install the package successfully", () => {
const promise = repeat(() => pip.installPackage("rsa"), 30000);
return expect(promise).resolves.toBeUndefined();
}, 3 * 30000);

test("should show the package info as not undefined", () => {
it("should show the package info as not undefined", () => {
const promise = pip.showPackageInfo("rsa");
return expect(promise).resolves.not.toBeUndefined();
});

test("should install the package again successfully", () => {
it("should install the package again successfully", () => {
const promise = pip.installPackage("rsa");
return expect(promise).resolves.toBeUndefined();
});
Expand All @@ -39,35 +39,35 @@ describe("Pip package installation and uninstallation (rsa)", () => {
packageInfo = (await promise) as pip.PackageInfo;
});

test("should have the correct package name", () => {
it("should have the correct package name", () => {
expect(packageInfo.name).toBe("rsa");
});

test("should have a valid version", () => {
it("should have a valid version", () => {
expect(packageInfo.version).toMatch(/^(\d+\.)?(\d+\.)?(\*|\d+)$/);
});

test("should have a valid location", () => {
it("should have a valid location", () => {
expect(fs.existsSync(packageInfo.location)).toBe(true);
});

test("should have the correct dependencies", () => {
it("should have the correct dependencies", () => {
expect(packageInfo.requires).toStrictEqual(["pyasn1"]);
});

test("should have the correct number of files", () => {
it("should have the correct number of files", () => {
expect(packageInfo.files).toHaveLength(42);
});

test("should have the correct directories that exist", () => {
it("should have the correct directories that exist", () => {
const directories = packageInfo.directories();
expect(directories).toHaveLength(2);
for (const directory of directories) {
expect(fs.existsSync(directory)).toBe(true);
}
});

test("should have the correct executables that exist", async () => {
it("should have the correct executables that exist", async () => {
const executables = await packageInfo.executables();
expect(executables).toHaveLength(6);
for (const executable of executables) {
Expand All @@ -77,22 +77,22 @@ describe("Pip package installation and uninstallation (rsa)", () => {
});

describe("Uninstalling the rsa package", () => {
test("should show the package info as not undefined", () => {
it("should show the package info as not undefined", () => {
const promise = pip.showPackageInfo("rsa");
return expect(promise).resolves.not.toBeUndefined();
});

test("should uninstall the package successfully", () => {
it("should uninstall the package successfully", () => {
const promise = pip.uninstallPackage("rsa");
return expect(promise).resolves.toBeUndefined();
});

test("should show the package info as undefined", () => {
it("should show the package info as undefined", () => {
const promise = pip.showPackageInfo("rsa");
return expect(promise).resolves.toBeUndefined();
});

test("should uninstall the package again successfully", () => {
it("should uninstall the package again successfully", () => {
const promise = pip.uninstallPackage("rsa");
return expect(promise).resolves.toBeUndefined();
});
Expand Down