Skip to content

Commit

Permalink
test: update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
janniks committed Apr 12, 2024
1 parent b73c0a4 commit c185bbb
Show file tree
Hide file tree
Showing 103 changed files with 544 additions and 213 deletions.
2 changes: 2 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ const config = {
maxWorkers: 1,
reporters: ["default", "jest-github-actions-reporter"],
testLocationInResults: true,

setupFilesAfterEnv: ["<rootDir>/setup.ts"],
};

export default config;
6 changes: 6 additions & 0 deletions setup.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { ensureEphemeralDevnetDown } from "./tests/helpers";

beforeAll(async () => {
console.log("Starting tests");
ensureEphemeralDevnetDown();
});
10 changes: 10 additions & 0 deletions tests/helpers.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { execSync as x } from "child_process";

export function ensureEphemeralDevnetDown() {
try {
x("docker ps -q --filter 'name=ephemeral-devnet' | xargs -r docker stop");
x("docker ps -aq --filter 'name=ephemeral-devnet' | xargs -r docker rm -v");
} catch (error) {
console.error("Failed to clean up previous devnet instances.", error);
}
}
4 changes: 3 additions & 1 deletion tests/integration/clarity/natives/buff-to-int-be.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ describe("buff-to-int-be", () => {
beforeAll(() => {
orchestrator = buildDevnetNetworkOrchestrator(getNetworkIdFromEnv());
orchestrator.start();
network = new StacksTestnet({ url: orchestrator.getStacksNodeUrl() });
network = new StacksTestnet({
url: orchestrator.getStacksNodeUrl().replace("localhost", "127.0.0.1"),
});
});

afterAll(() => {
Expand Down
4 changes: 3 additions & 1 deletion tests/integration/clarity/natives/buff-to-int-le.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ describe("buff-to-int-le", () => {
beforeAll(() => {
orchestrator = buildDevnetNetworkOrchestrator(getNetworkIdFromEnv());
orchestrator.start();
network = new StacksTestnet({ url: orchestrator.getStacksNodeUrl() });
network = new StacksTestnet({
url: orchestrator.getStacksNodeUrl().replace("localhost", "127.0.0.1"),
});
nonce = 0;
});

Expand Down
4 changes: 3 additions & 1 deletion tests/integration/clarity/natives/buff-to-uint-be.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ describe("buff-to-uint-be", () => {
beforeAll(() => {
orchestrator = buildDevnetNetworkOrchestrator(getNetworkIdFromEnv());
orchestrator.start();
network = new StacksTestnet({ url: orchestrator.getStacksNodeUrl() });
network = new StacksTestnet({
url: orchestrator.getStacksNodeUrl().replace("localhost", "127.0.0.1"),
});
});

afterAll(() => {
Expand Down
4 changes: 3 additions & 1 deletion tests/integration/clarity/natives/buff-to-uint-le.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ describe("buff-to-uint-le", () => {
beforeAll(() => {
orchestrator = buildDevnetNetworkOrchestrator(getNetworkIdFromEnv());
orchestrator.start();
network = new StacksTestnet({ url: orchestrator.getStacksNodeUrl() });
network = new StacksTestnet({
url: orchestrator.getStacksNodeUrl().replace("localhost", "127.0.0.1"),
});
});

afterAll(() => {
Expand Down
4 changes: 3 additions & 1 deletion tests/integration/clarity/natives/chain-id.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ describe("chain-id", () => {
console.log(`network #${networkId}`);
orchestrator = buildDevnetNetworkOrchestrator(networkId);
orchestrator.start();
network = new StacksTestnet({ url: orchestrator.getStacksNodeUrl() });
network = new StacksTestnet({
url: orchestrator.getStacksNodeUrl().replace("localhost", "127.0.0.1"),
});
});

afterAll(() => {
Expand Down
4 changes: 3 additions & 1 deletion tests/integration/clarity/natives/element-at.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ describe("element-at?", () => {
console.log(`network #${networkId}`);
orchestrator = buildDevnetNetworkOrchestrator(networkId);
orchestrator.start();
network = new StacksTestnet({ url: orchestrator.getStacksNodeUrl() });
network = new StacksTestnet({
url: orchestrator.getStacksNodeUrl().replace("localhost", "127.0.0.1"),
});
nonce = 0;
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ describe("from-consensus-buff?", () => {
console.log(`network #${networkId}`);
orchestrator = buildDevnetNetworkOrchestrator(networkId);
orchestrator.start();
network = new StacksTestnet({ url: orchestrator.getStacksNodeUrl() });
network = new StacksTestnet({
url: orchestrator.getStacksNodeUrl().replace("localhost", "127.0.0.1"),
});
nonce = 0;
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ describe("get-burn-block-info?", () => {
console.log(`network #${networkId}`);
orchestrator = buildDevnetNetworkOrchestrator(networkId);
orchestrator.start();
network = new StacksTestnet({ url: orchestrator.getStacksNodeUrl() });
network = new StacksTestnet({
url: orchestrator.getStacksNodeUrl().replace("localhost", "127.0.0.1"),
});
});

afterAll(() => {
Expand Down
4 changes: 3 additions & 1 deletion tests/integration/clarity/natives/index-of.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ describe("index-of?", () => {
console.log(`network #${networkId}`);
orchestrator = buildDevnetNetworkOrchestrator(networkId);
orchestrator.start();
network = new StacksTestnet({ url: orchestrator.getStacksNodeUrl() });
network = new StacksTestnet({
url: orchestrator.getStacksNodeUrl().replace("localhost", "127.0.0.1"),
});
nonce = 0;
});

Expand Down
4 changes: 3 additions & 1 deletion tests/integration/clarity/natives/int-to-ascii.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ describe("int-to-ascii", () => {
console.log(`network #${networkId}`);
orchestrator = buildDevnetNetworkOrchestrator(networkId);
orchestrator.start();
network = new StacksTestnet({ url: orchestrator.getStacksNodeUrl() });
network = new StacksTestnet({
url: orchestrator.getStacksNodeUrl().replace("localhost", "127.0.0.1"),
});
});

afterAll(() => {
Expand Down
4 changes: 3 additions & 1 deletion tests/integration/clarity/natives/int-to-utf8.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ describe("int-to-utf8", () => {
console.log(`network #${networkId}`);
orchestrator = buildDevnetNetworkOrchestrator(networkId);
orchestrator.start();
network = new StacksTestnet({ url: orchestrator.getStacksNodeUrl() });
network = new StacksTestnet({
url: orchestrator.getStacksNodeUrl().replace("localhost", "127.0.0.1"),
});
});

afterAll(() => {
Expand Down
4 changes: 3 additions & 1 deletion tests/integration/clarity/natives/is-standard.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ describe("is-standard", () => {
console.log(`network #${networkId}`);
orchestrator = buildDevnetNetworkOrchestrator(networkId);
orchestrator.start();
network = new StacksTestnet({ url: orchestrator.getStacksNodeUrl() });
network = new StacksTestnet({
url: orchestrator.getStacksNodeUrl().replace("localhost", "127.0.0.1"),
});
});

afterAll(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ describe("principal-construct?", () => {
console.log(`network #${networkId}`);
orchestrator = buildDevnetNetworkOrchestrator(networkId);
orchestrator.start();
network = new StacksTestnet({ url: orchestrator.getStacksNodeUrl() });
network = new StacksTestnet({
url: orchestrator.getStacksNodeUrl().replace("localhost", "127.0.0.1"),
});
});

afterAll(() => {
Expand Down
4 changes: 3 additions & 1 deletion tests/integration/clarity/natives/principal-destruct.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ describe("principal-destruct?", () => {
console.log(`network #${networkId}`);
orchestrator = buildDevnetNetworkOrchestrator(networkId);
orchestrator.start();
network = new StacksTestnet({ url: orchestrator.getStacksNodeUrl() });
network = new StacksTestnet({
url: orchestrator.getStacksNodeUrl().replace("localhost", "127.0.0.1"),
});
});

afterAll(() => {
Expand Down
4 changes: 3 additions & 1 deletion tests/integration/clarity/natives/replace-at.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ describe("replace-at?", () => {
console.log(`network #${networkId}`);
orchestrator = buildDevnetNetworkOrchestrator(networkId);
orchestrator.start();
network = new StacksTestnet({ url: orchestrator.getStacksNodeUrl() });
network = new StacksTestnet({
url: orchestrator.getStacksNodeUrl().replace("localhost", "127.0.0.1"),
});
});

afterAll(() => {
Expand Down
4 changes: 3 additions & 1 deletion tests/integration/clarity/natives/slice.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ describe("slice?", () => {
console.log(`network #${networkId}`);
orchestrator = buildDevnetNetworkOrchestrator(networkId);
orchestrator.start();
network = new StacksTestnet({ url: orchestrator.getStacksNodeUrl() });
network = new StacksTestnet({
url: orchestrator.getStacksNodeUrl().replace("localhost", "127.0.0.1"),
});
});

afterAll(() => {
Expand Down
4 changes: 3 additions & 1 deletion tests/integration/clarity/natives/string-to-int.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ describe("string-to-int?", () => {
console.log(`network #${networkId}`);
orchestrator = buildDevnetNetworkOrchestrator(networkId);
orchestrator.start();
network = new StacksTestnet({ url: orchestrator.getStacksNodeUrl() });
network = new StacksTestnet({
url: orchestrator.getStacksNodeUrl().replace("localhost", "127.0.0.1"),
});
});

afterAll(() => {
Expand Down
4 changes: 3 additions & 1 deletion tests/integration/clarity/natives/string-to-uint.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ describe("string-to-uint?", () => {
console.log(`network #${networkId}`);
orchestrator = buildDevnetNetworkOrchestrator(networkId);
orchestrator.start();
network = new StacksTestnet({ url: orchestrator.getStacksNodeUrl() });
network = new StacksTestnet({
url: orchestrator.getStacksNodeUrl().replace("localhost", "127.0.0.1"),
});
nonce = 0;
});

Expand Down
4 changes: 3 additions & 1 deletion tests/integration/clarity/natives/stx-account.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ describe("stx-account", () => {
epoch_2_2: 300,
});
orchestrator.start();
network = new StacksTestnet({ url: orchestrator.getStacksNodeUrl() });
network = new StacksTestnet({
url: orchestrator.getStacksNodeUrl().replace("localhost", "127.0.0.1"),
});
});

afterAll(() => {
Expand Down
4 changes: 3 additions & 1 deletion tests/integration/clarity/natives/stx-transfer-memo.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ describe("stx-transfer-memo?", () => {
console.log(`network #${networkId}`);
orchestrator = buildDevnetNetworkOrchestrator(networkId);
orchestrator.start();
network = new StacksTestnet({ url: orchestrator.getStacksNodeUrl() });
network = new StacksTestnet({
url: orchestrator.getStacksNodeUrl().replace("localhost", "127.0.0.1"),
});
nonce = 0;
});

Expand Down
4 changes: 3 additions & 1 deletion tests/integration/clarity/natives/to-consensus-buff.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ describe("to-consensus-buff?", () => {
console.log(`network #${networkId}`);
orchestrator = buildDevnetNetworkOrchestrator(networkId);
orchestrator.start();
network = new StacksTestnet({ url: orchestrator.getStacksNodeUrl() });
network = new StacksTestnet({
url: orchestrator.getStacksNodeUrl().replace("localhost", "127.0.0.1"),
});
});

afterAll(() => {
Expand Down
4 changes: 3 additions & 1 deletion tests/integration/clarity/natives/tx-sponsor.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ describe("tx-sponsor?", () => {
console.log(`network #${networkId}`);
orchestrator = buildDevnetNetworkOrchestrator(networkId);
orchestrator.start();
network = new StacksTestnet({ url: orchestrator.getStacksNodeUrl() });
network = new StacksTestnet({
url: orchestrator.getStacksNodeUrl().replace("localhost", "127.0.0.1"),
});
});

afterAll(() => {
Expand Down
4 changes: 3 additions & 1 deletion tests/integration/clarity/traits/call-nested-1.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ describe("call functions with nested traits", () => {
pox_2_activation: 120,
});
orchestrator.start();
network = new StacksTestnet({ url: orchestrator.getStacksNodeUrl() });
network = new StacksTestnet({
url: orchestrator.getStacksNodeUrl().replace("localhost", "127.0.0.1"),
});
});

afterAll(() => {
Expand Down
4 changes: 3 additions & 1 deletion tests/integration/clarity/traits/call-nested-2.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ describe("call functions with nested traits", () => {
pox_2_activation: 120,
});
orchestrator.start();
network = new StacksTestnet({ url: orchestrator.getStacksNodeUrl() });
network = new StacksTestnet({
url: orchestrator.getStacksNodeUrl().replace("localhost", "127.0.0.1"),
});
});

afterAll(() => {
Expand Down
4 changes: 3 additions & 1 deletion tests/integration/clarity/traits/call-nested-3-err.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ describe("call functions with nested traits", () => {
pox_2_activation: 120,
});
orchestrator.start();
network = new StacksTestnet({ url: orchestrator.getStacksNodeUrl() });
network = new StacksTestnet({
url: orchestrator.getStacksNodeUrl().replace("localhost", "127.0.0.1"),
});
});

afterAll(() => {
Expand Down
4 changes: 3 additions & 1 deletion tests/integration/clarity/traits/call-nested-3-ok.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ describe("call functions with nested traits", () => {
pox_2_activation: 120,
});
orchestrator.start();
network = new StacksTestnet({ url: orchestrator.getStacksNodeUrl() });
network = new StacksTestnet({
url: orchestrator.getStacksNodeUrl().replace("localhost", "127.0.0.1"),
});
});

afterAll(() => {
Expand Down
4 changes: 3 additions & 1 deletion tests/integration/clarity/traits/call-nested-4.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ describe("call functions with nested traits", () => {
pox_2_activation: 120,
});
orchestrator.start();
network = new StacksTestnet({ url: orchestrator.getStacksNodeUrl() });
network = new StacksTestnet({
url: orchestrator.getStacksNodeUrl().replace("localhost", "127.0.0.1"),
});
});

afterAll(() => {
Expand Down
6 changes: 4 additions & 2 deletions tests/integration/clarity/traits/circular.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ describe("use", () => {
pox_2_activation: 120,
});
orchestrator.start();
network = new StacksTestnet({ url: orchestrator.getStacksNodeUrl() });
network = new StacksTestnet({
url: orchestrator.getStacksNodeUrl().replace("localhost", "127.0.0.1"),
});
});

afterAll(() => {
Expand All @@ -48,7 +50,7 @@ describe("use", () => {
const circularTrait2 = `(define-trait circular1 (
(circular (<circular2>) (response bool bool))
))
(define-trait circular2 (
(circular (<circular1>) (response bool bool))
))`;
Expand Down
4 changes: 3 additions & 1 deletion tests/integration/clarity/traits/double.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ describe("use", () => {
pox_2_activation: 120,
});
orchestrator.start();
network = new StacksTestnet({ url: orchestrator.getStacksNodeUrl() });
network = new StacksTestnet({
url: orchestrator.getStacksNodeUrl().replace("localhost", "127.0.0.1"),
});
});

afterAll(() => {
Expand Down
4 changes: 3 additions & 1 deletion tests/integration/clarity/traits/empty.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ describe("empty trait", () => {
pox_2_activation: 120,
});
orchestrator.start();
network = new StacksTestnet({ url: orchestrator.getStacksNodeUrl() });
network = new StacksTestnet({
url: orchestrator.getStacksNodeUrl().replace("localhost", "127.0.0.1"),
});
});

afterAll(() => {
Expand Down
4 changes: 3 additions & 1 deletion tests/integration/clarity/traits/identical-double.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ describe("define a trait with duplicate identical methods", () => {
pox_2_activation: 120,
});
orchestrator.start();
network = new StacksTestnet({ url: orchestrator.getStacksNodeUrl() });
network = new StacksTestnet({
url: orchestrator.getStacksNodeUrl().replace("localhost", "127.0.0.1"),
});
});

afterAll(() => {
Expand Down
4 changes: 3 additions & 1 deletion tests/integration/clarity/traits/impl-double-1.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ describe("use", () => {
pox_2_activation: 120,
});
orchestrator.start();
network = new StacksTestnet({ url: orchestrator.getStacksNodeUrl() });
network = new StacksTestnet({
url: orchestrator.getStacksNodeUrl().replace("localhost", "127.0.0.1"),
});
});

afterAll(() => {
Expand Down
4 changes: 3 additions & 1 deletion tests/integration/clarity/traits/impl-double-both.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ describe("use", () => {
pox_2_activation: 120,
});
orchestrator.start();
network = new StacksTestnet({ url: orchestrator.getStacksNodeUrl() });
network = new StacksTestnet({
url: orchestrator.getStacksNodeUrl().replace("localhost", "127.0.0.1"),
});
});

afterAll(() => {
Expand Down
Loading

0 comments on commit c185bbb

Please sign in to comment.