Skip to content

Commit

Permalink
test: update trait tests
Browse files Browse the repository at this point in the history
  • Loading branch information
janniks committed Apr 17, 2024
1 parent 2c1f823 commit fe6d5e8
Show file tree
Hide file tree
Showing 25 changed files with 218 additions and 236 deletions.
18 changes: 9 additions & 9 deletions tests/integration/clarity/traits/call-nested-2.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
buildDevnetNetworkOrchestrator,
getNetworkIdFromEnv,
getChainInfo,
EPOCH_TIMELINE_LONG_2_05,
} from "../../helpers";
import { DevnetNetworkOrchestrator } from "@hirosystems/stacks-devnet-js";
import { contract_call, load_versioned } from "./helper";
Expand All @@ -13,19 +14,16 @@ import { contractPrincipalCV } from "@stacks/transactions/dist/clarity/types/pri
describe("call functions with nested traits", () => {
let orchestrator: DevnetNetworkOrchestrator;
let network: StacksNetwork;
const STACKS_2_1_EPOCH = 112;

let networkId: number;

beforeAll(() => {
networkId = getNetworkIdFromEnv();
console.log(`network #${networkId}`);
orchestrator = buildDevnetNetworkOrchestrator(networkId, {
epoch_2_0: 100,
epoch_2_05: 102,
epoch_2_1: STACKS_2_1_EPOCH,
pox_2_activation: 120,
});
orchestrator = buildDevnetNetworkOrchestrator(
networkId,
EPOCH_TIMELINE_LONG_2_05,
);
orchestrator.start();
network = new StacksTestnet({
url: orchestrator.getStacksNodeUrl().replace("localhost", "127.0.0.1"),
Expand Down Expand Up @@ -73,14 +71,16 @@ describe("call functions with nested traits", () => {

// Make sure this we stayed in 2.05
let chainInfo = await getChainInfo(network);
expect(chainInfo.burn_block_height).toBeLessThanOrEqual(STACKS_2_1_EPOCH);
expect(chainInfo.burn_block_height).toBeLessThanOrEqual(
EPOCH_TIMELINE_LONG_2_05.epoch_2_1,
);
});

describe("in 2.1", () => {
beforeAll(async () => {
// Wait for 2.1 to go live
await orchestrator.waitForStacksBlockAnchoredOnBitcoinBlockOfHeight(
STACKS_2_1_EPOCH + 1,
EPOCH_TIMELINE_LONG_2_05.epoch_2_1 + 1,
);
});

Expand Down
18 changes: 9 additions & 9 deletions tests/integration/clarity/traits/call-nested-3-err.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
buildDevnetNetworkOrchestrator,
getNetworkIdFromEnv,
getChainInfo,
EPOCH_TIMELINE_LONG_2_05,
} from "../../helpers";
import { DevnetNetworkOrchestrator } from "@hirosystems/stacks-devnet-js";
import { contract_call, load_versioned } from "./helper";
Expand All @@ -13,19 +14,16 @@ import { contractPrincipalCV } from "@stacks/transactions/dist/clarity/types/pri
describe("call functions with nested traits", () => {
let orchestrator: DevnetNetworkOrchestrator;
let network: StacksNetwork;
const STACKS_2_1_EPOCH = 112;

let networkId: number;

beforeAll(() => {
networkId = getNetworkIdFromEnv();
console.log(`network #${networkId}`);
orchestrator = buildDevnetNetworkOrchestrator(networkId, {
epoch_2_0: 100,
epoch_2_05: 102,
epoch_2_1: STACKS_2_1_EPOCH,
pox_2_activation: 120,
});
orchestrator = buildDevnetNetworkOrchestrator(
networkId,
EPOCH_TIMELINE_LONG_2_05,
);
orchestrator.start();
network = new StacksTestnet({
url: orchestrator.getStacksNodeUrl().replace("localhost", "127.0.0.1"),
Expand Down Expand Up @@ -77,14 +75,16 @@ describe("call functions with nested traits", () => {

// Make sure this we stayed in 2.05
let chainInfo = await getChainInfo(network);
expect(chainInfo.burn_block_height).toBeLessThanOrEqual(STACKS_2_1_EPOCH);
expect(chainInfo.burn_block_height).toBeLessThanOrEqual(
EPOCH_TIMELINE_LONG_2_05.epoch_2_1,
);
});

describe("in 2.1", () => {
beforeAll(async () => {
// Wait for 2.1 to go live
await orchestrator.waitForStacksBlockAnchoredOnBitcoinBlockOfHeight(
STACKS_2_1_EPOCH + 1,
EPOCH_TIMELINE_LONG_2_05.epoch_2_1 + 1,
);
});

Expand Down
19 changes: 9 additions & 10 deletions tests/integration/clarity/traits/call-nested-3-ok.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,13 @@ import {
buildDevnetNetworkOrchestrator,
getNetworkIdFromEnv,
getChainInfo,
EPOCH_TIMELINE_LONG_2_05,
} from "../../helpers";
import { DevnetNetworkOrchestrator } from "@hirosystems/stacks-devnet-js";
import { contract_call, load_versioned } from "./helper";
import { responseOkCV } from "@stacks/transactions";
import { contractPrincipalCV } from "@stacks/transactions/dist/clarity/types/principalCV";

const STACKS_2_1_EPOCH = 112;

describe("call functions with nested traits", () => {
let orchestrator: DevnetNetworkOrchestrator;
let network: StacksNetwork;
Expand All @@ -21,12 +20,10 @@ describe("call functions with nested traits", () => {
beforeAll(() => {
networkId = getNetworkIdFromEnv();
console.log(`network #${networkId}`);
orchestrator = buildDevnetNetworkOrchestrator(networkId, {
epoch_2_0: 100,
epoch_2_05: 102,
epoch_2_1: STACKS_2_1_EPOCH,
pox_2_activation: 120,
});
orchestrator = buildDevnetNetworkOrchestrator(
networkId,
EPOCH_TIMELINE_LONG_2_05,
);
orchestrator.start();
network = new StacksTestnet({
url: orchestrator.getStacksNodeUrl().replace("localhost", "127.0.0.1"),
Expand Down Expand Up @@ -78,14 +75,16 @@ describe("call functions with nested traits", () => {

// Make sure this we stayed in 2.05
let chainInfo = await getChainInfo(network);
expect(chainInfo.burn_block_height).toBeLessThanOrEqual(STACKS_2_1_EPOCH);
expect(chainInfo.burn_block_height).toBeLessThanOrEqual(
EPOCH_TIMELINE_LONG_2_05.epoch_2_1,
);
});

describe("in 2.1", () => {
beforeAll(async () => {
// Wait for 2.1 to go live
await orchestrator.waitForStacksBlockAnchoredOnBitcoinBlockOfHeight(
STACKS_2_1_EPOCH + 1,
EPOCH_TIMELINE_LONG_2_05.epoch_2_1 + 1,
);
});

Expand Down
18 changes: 9 additions & 9 deletions tests/integration/clarity/traits/call-nested-4.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
buildDevnetNetworkOrchestrator,
getNetworkIdFromEnv,
getChainInfo,
EPOCH_TIMELINE_LONG_2_05,
} from "../../helpers";
import { DevnetNetworkOrchestrator } from "@hirosystems/stacks-devnet-js";
import { contract_call, load_versioned } from "./helper";
Expand All @@ -13,19 +14,16 @@ import { contractPrincipalCV } from "@stacks/transactions/dist/clarity/types/pri
describe("call functions with nested traits", () => {
let orchestrator: DevnetNetworkOrchestrator;
let network: StacksNetwork;
const STACKS_2_1_EPOCH = 112;

let networkId: number;

beforeAll(() => {
networkId = getNetworkIdFromEnv();
console.log(`network #${networkId}`);
orchestrator = buildDevnetNetworkOrchestrator(networkId, {
epoch_2_0: 100,
epoch_2_05: 102,
epoch_2_1: STACKS_2_1_EPOCH,
pox_2_activation: 120,
});
orchestrator = buildDevnetNetworkOrchestrator(
networkId,
EPOCH_TIMELINE_LONG_2_05,
);
orchestrator.start();
network = new StacksTestnet({
url: orchestrator.getStacksNodeUrl().replace("localhost", "127.0.0.1"),
Expand Down Expand Up @@ -77,14 +75,16 @@ describe("call functions with nested traits", () => {

// Make sure this we stayed in 2.05
let chainInfo = await getChainInfo(network);
expect(chainInfo.burn_block_height).toBeLessThanOrEqual(STACKS_2_1_EPOCH);
expect(chainInfo.burn_block_height).toBeLessThanOrEqual(
EPOCH_TIMELINE_LONG_2_05.epoch_2_1,
);
});

describe("in 2.1", () => {
beforeAll(async () => {
// Wait for 2.1 to go live
await orchestrator.waitForStacksBlockAnchoredOnBitcoinBlockOfHeight(
STACKS_2_1_EPOCH + 1,
EPOCH_TIMELINE_LONG_2_05.epoch_2_1 + 1,
);
});

Expand Down
18 changes: 9 additions & 9 deletions tests/integration/clarity/traits/circular.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,23 @@ import {
waitForStacksTransaction,
getNetworkIdFromEnv,
getChainInfo,
EPOCH_TIMELINE_LONG_2_05,
} from "../../helpers";
import { DevnetNetworkOrchestrator } from "@hirosystems/stacks-devnet-js";

describe("use", () => {
let orchestrator: DevnetNetworkOrchestrator;
let network: StacksNetwork;
const STACKS_2_1_EPOCH = 112;

let networkId: number;

beforeAll(() => {
networkId = getNetworkIdFromEnv();
console.log(`network #${networkId}`);
orchestrator = buildDevnetNetworkOrchestrator(networkId, {
epoch_2_0: 100,
epoch_2_05: 102,
epoch_2_1: STACKS_2_1_EPOCH,
pox_2_activation: 120,
});
orchestrator = buildDevnetNetworkOrchestrator(
networkId,
EPOCH_TIMELINE_LONG_2_05,
);
orchestrator.start();
network = new StacksTestnet({
url: orchestrator.getStacksNodeUrl().replace("localhost", "127.0.0.1"),
Expand All @@ -59,7 +57,9 @@ describe("use", () => {
afterAll(async () => {
// Make sure this we stayed in 2.05
let chainInfo = await getChainInfo(network);
expect(chainInfo.burn_block_height).toBeLessThanOrEqual(STACKS_2_1_EPOCH);
expect(chainInfo.burn_block_height).toBeLessThanOrEqual(
EPOCH_TIMELINE_LONG_2_05.epoch_2_1,
);
});

it("publish a self-circular trait", async () => {
Expand Down Expand Up @@ -135,7 +135,7 @@ describe("use", () => {
beforeAll(async () => {
// Wait for 2.1 to go live
await orchestrator.waitForStacksBlockAnchoredOnBitcoinBlockOfHeight(
STACKS_2_1_EPOCH + 1,
EPOCH_TIMELINE_LONG_2_05.epoch_2_1 + 1,
);
});

Expand Down
18 changes: 9 additions & 9 deletions tests/integration/clarity/traits/double.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,23 @@ import {
waitForStacksTransaction,
getNetworkIdFromEnv,
getChainInfo,
EPOCH_TIMELINE_LONG_2_05,
} from "../../helpers";
import { DevnetNetworkOrchestrator } from "@hirosystems/stacks-devnet-js";

describe("use", () => {
let orchestrator: DevnetNetworkOrchestrator;
let network: StacksNetwork;
const STACKS_2_1_EPOCH = 112;

let networkId: number;

beforeAll(() => {
networkId = getNetworkIdFromEnv();
console.log(`network #${networkId}`);
orchestrator = buildDevnetNetworkOrchestrator(networkId, {
epoch_2_0: 100,
epoch_2_05: 102,
epoch_2_1: STACKS_2_1_EPOCH,
pox_2_activation: 120,
});
orchestrator = buildDevnetNetworkOrchestrator(
networkId,
EPOCH_TIMELINE_LONG_2_05,
);
orchestrator.start();
network = new StacksTestnet({
url: orchestrator.getStacksNodeUrl().replace("localhost", "127.0.0.1"),
Expand All @@ -52,7 +50,9 @@ describe("use", () => {
afterAll(async () => {
// Make sure this we stayed in 2.05
let chainInfo = await getChainInfo(network);
expect(chainInfo.burn_block_height).toBeLessThanOrEqual(STACKS_2_1_EPOCH);
expect(chainInfo.burn_block_height).toBeLessThanOrEqual(
EPOCH_TIMELINE_LONG_2_05.epoch_2_1,
);
});

it("define a trait with duplicate method names", async () => {
Expand Down Expand Up @@ -94,7 +94,7 @@ describe("use", () => {
beforeAll(async () => {
// Wait for 2.1 to go live
await orchestrator.waitForStacksBlockAnchoredOnBitcoinBlockOfHeight(
STACKS_2_1_EPOCH + 1,
EPOCH_TIMELINE_LONG_2_05.epoch_2_1 + 1,
);
});

Expand Down
18 changes: 9 additions & 9 deletions tests/integration/clarity/traits/empty.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,23 @@ import {
waitForStacksTransaction,
getNetworkIdFromEnv,
getChainInfo,
EPOCH_TIMELINE_LONG_2_05,
} from "../../helpers";
import { DevnetNetworkOrchestrator } from "@hirosystems/stacks-devnet-js";

describe("empty trait", () => {
let orchestrator: DevnetNetworkOrchestrator;
let network: StacksNetwork;
const STACKS_2_1_EPOCH = 112;

let networkId: number;

beforeAll(() => {
networkId = getNetworkIdFromEnv();
console.log(`network #${networkId}`);
orchestrator = buildDevnetNetworkOrchestrator(networkId, {
epoch_2_0: 100,
epoch_2_05: 102,
epoch_2_1: STACKS_2_1_EPOCH,
pox_2_activation: 120,
});
orchestrator = buildDevnetNetworkOrchestrator(
networkId,
EPOCH_TIMELINE_LONG_2_05,
);
orchestrator.start();
network = new StacksTestnet({
url: orchestrator.getStacksNodeUrl().replace("localhost", "127.0.0.1"),
Expand All @@ -50,7 +48,9 @@ describe("empty trait", () => {
afterAll(async () => {
// Make sure this we stayed in 2.05
let chainInfo = await getChainInfo(network);
expect(chainInfo.burn_block_height).toBeLessThanOrEqual(STACKS_2_1_EPOCH);
expect(chainInfo.burn_block_height).toBeLessThanOrEqual(
EPOCH_TIMELINE_LONG_2_05.epoch_2_1,
);
});

it("publish an empty trait", async () => {
Expand Down Expand Up @@ -126,7 +126,7 @@ describe("empty trait", () => {
beforeAll(async () => {
// Wait for 2.1 to go live
await orchestrator.waitForStacksBlockAnchoredOnBitcoinBlockOfHeight(
STACKS_2_1_EPOCH + 1,
EPOCH_TIMELINE_LONG_2_05.epoch_2_1 + 1,
);
});

Expand Down
Loading

0 comments on commit fe6d5e8

Please sign in to comment.