Skip to content

Commit

Permalink
refactor(tests): use DEFAULT_SDK
Browse files Browse the repository at this point in the history
  • Loading branch information
endersonmaia committed Oct 22, 2024
1 parent f84703a commit e9ca36b
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 13 deletions.
2 changes: 1 addition & 1 deletion apps/cli/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ const DEFAULT_RAM_IMAGE_DOCKER = "/usr/share/cartesi-machine/images/linux.bin";
const DEFAULT_RAM_IMAGE_LINUX = "/usr/share/cartesi-machine/images/linux.bin";
const DEFAULT_RAM_IMAGE_MAC =
"/opt/homebrew/share/cartesi-machine/images/linux.bin";
const DEFAULT_SDK = "cartesi/sdk:0.12.0-alpha.0";
export const DEFAULT_SDK = "cartesi/sdk:0.12.0-alpha.0";

type Builder = "directory" | "docker" | "empty" | "none" | "tar";
type DriveFormat = "ext2" | "sqfs";
Expand Down
4 changes: 2 additions & 2 deletions apps/cli/test/builder/directory.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import fs from "fs-extra";
import path from "path";
import { describe, expect } from "vitest";
import { build } from "../../src/builder/directory";
import { DirectoryDriveConfig } from "../../src/config";
import { DEFAULT_SDK, DirectoryDriveConfig } from "../../src/config";
import { tmpdirTest } from "./tmpdirTest";

describe("when building with the directory builder", () => {
const image = "cartesi/sdk:0.11.0";
const image = DEFAULT_SDK;

tmpdirTest(
"should fail when the directory doesn't exists",
Expand Down
4 changes: 2 additions & 2 deletions apps/cli/test/builder/docker.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ import { beforeEach } from "node:test";
import path from "path";
import { describe, expect } from "vitest";
import { build } from "../../src/builder/docker";
import { DockerDriveConfig } from "../../src/config";
import { DEFAULT_SDK, DockerDriveConfig } from "../../src/config";
import { tmpdirTest } from "./tmpdirTest";

describe("when building with the docker builder", () => {
const image = "cartesi/sdk:0.11.0";
const image = DEFAULT_SDK;

beforeEach(({ name }) => {
fs.mkdirpSync(path.join(__dirname, "output", name));
Expand Down
4 changes: 2 additions & 2 deletions apps/cli/test/builder/empty.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import fs from "fs-extra";
import path from "path";
import { describe, expect } from "vitest";
import { build } from "../../src/builder/empty";
import { EmptyDriveConfig } from "../../src/config";
import { DEFAULT_SDK, EmptyDriveConfig } from "../../src/config";
import { tmpdirTest } from "./tmpdirTest";

describe("when building with the empty builder", () => {
const image = "cartesi/sdk:0.11.0";
const image = DEFAULT_SDK;

tmpdirTest("should fail with an invalid size", async ({ tmpdir }) => {
const destination = tmpdir;
Expand Down
4 changes: 2 additions & 2 deletions apps/cli/test/builder/tar.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import fs from "fs-extra";
import path from "path";
import { describe, expect } from "vitest";
import { build } from "../../src/builder/tar";
import { TarDriveConfig } from "../../src/config";
import { DEFAULT_SDK, TarDriveConfig } from "../../src/config";
import { tmpdirTest } from "./tmpdirTest";

describe("when building with the tar builder", () => {
const image = "cartesi/sdk:0.11.0";
const image = DEFAULT_SDK;

tmpdirTest("should not build a missing file", async ({ tmpdir }) => {
const destination = tmpdir;
Expand Down
3 changes: 2 additions & 1 deletion apps/cli/test/exec/cartesi-machine.test.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { satisfies } from "semver";
import { describe, expect, it } from "vitest";
import { DEFAULT_SDK } from "../../src/config.js";
import { cartesiMachine } from "../../src/exec/index.js";

describe("cartesi-machine", () => {
it("should report version", async () => {
const version = await cartesiMachine.version({
forceDocker: true,
image: "cartesi/sdk:0.11.0",
image: DEFAULT_SDK,
});
expect(version).toBeDefined();
expect(
Expand Down
3 changes: 2 additions & 1 deletion apps/cli/test/exec/crane.test.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { satisfies } from "semver";
import { describe, expect, it } from "vitest";
import { DEFAULT_SDK } from "../../src/config.js";
import { crane } from "../../src/exec/index.js";

describe("crane", () => {
it("should report version", async () => {
const version = await crane.version({
forceDocker: true,
image: "cartesi/sdk:0.11.0",
image: DEFAULT_SDK,
});
expect(version).toBeDefined();
expect(
Expand Down
3 changes: 2 additions & 1 deletion apps/cli/test/exec/genext2fs.test.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { satisfies } from "semver";
import { describe, expect, it } from "vitest";
import { DEFAULT_SDK } from "../../src/config.js";
import { genext2fs } from "../../src/exec/index.js";

describe("genext2fs", () => {
it("should report version", async () => {
const version = await genext2fs.version({
forceDocker: true,
image: "cartesi/sdk:0.11.0",
image: DEFAULT_SDK,
});

expect(version).toBeDefined();
Expand Down
3 changes: 2 additions & 1 deletion apps/cli/test/exec/mksquashfs.test.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { satisfies } from "semver";
import { describe, expect, it } from "vitest";
import { DEFAULT_SDK } from "../../src/config.js";
import { mksquashfs } from "../../src/exec/index.js";

describe("mksquashfs", () => {
it("should report version", async () => {
const version = await mksquashfs.version({
forceDocker: true,
image: "cartesi/sdk:0.11.0",
image: DEFAULT_SDK,
});
expect(version).toBeDefined();
expect(
Expand Down

0 comments on commit e9ca36b

Please sign in to comment.