Skip to content

Commit fe6d5e8

Browse files
committed
test: update trait tests
1 parent 2c1f823 commit fe6d5e8

25 files changed

+218
-236
lines changed

Diff for: tests/integration/clarity/traits/call-nested-2.spec.ts

+9-9
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {
44
buildDevnetNetworkOrchestrator,
55
getNetworkIdFromEnv,
66
getChainInfo,
7+
EPOCH_TIMELINE_LONG_2_05,
78
} from "../../helpers";
89
import { DevnetNetworkOrchestrator } from "@hirosystems/stacks-devnet-js";
910
import { contract_call, load_versioned } from "./helper";
@@ -13,19 +14,16 @@ import { contractPrincipalCV } from "@stacks/transactions/dist/clarity/types/pri
1314
describe("call functions with nested traits", () => {
1415
let orchestrator: DevnetNetworkOrchestrator;
1516
let network: StacksNetwork;
16-
const STACKS_2_1_EPOCH = 112;
1717

1818
let networkId: number;
1919

2020
beforeAll(() => {
2121
networkId = getNetworkIdFromEnv();
2222
console.log(`network #${networkId}`);
23-
orchestrator = buildDevnetNetworkOrchestrator(networkId, {
24-
epoch_2_0: 100,
25-
epoch_2_05: 102,
26-
epoch_2_1: STACKS_2_1_EPOCH,
27-
pox_2_activation: 120,
28-
});
23+
orchestrator = buildDevnetNetworkOrchestrator(
24+
networkId,
25+
EPOCH_TIMELINE_LONG_2_05,
26+
);
2927
orchestrator.start();
3028
network = new StacksTestnet({
3129
url: orchestrator.getStacksNodeUrl().replace("localhost", "127.0.0.1"),
@@ -73,14 +71,16 @@ describe("call functions with nested traits", () => {
7371

7472
// Make sure this we stayed in 2.05
7573
let chainInfo = await getChainInfo(network);
76-
expect(chainInfo.burn_block_height).toBeLessThanOrEqual(STACKS_2_1_EPOCH);
74+
expect(chainInfo.burn_block_height).toBeLessThanOrEqual(
75+
EPOCH_TIMELINE_LONG_2_05.epoch_2_1,
76+
);
7777
});
7878

7979
describe("in 2.1", () => {
8080
beforeAll(async () => {
8181
// Wait for 2.1 to go live
8282
await orchestrator.waitForStacksBlockAnchoredOnBitcoinBlockOfHeight(
83-
STACKS_2_1_EPOCH + 1,
83+
EPOCH_TIMELINE_LONG_2_05.epoch_2_1 + 1,
8484
);
8585
});
8686

Diff for: tests/integration/clarity/traits/call-nested-3-err.spec.ts

+9-9
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {
44
buildDevnetNetworkOrchestrator,
55
getNetworkIdFromEnv,
66
getChainInfo,
7+
EPOCH_TIMELINE_LONG_2_05,
78
} from "../../helpers";
89
import { DevnetNetworkOrchestrator } from "@hirosystems/stacks-devnet-js";
910
import { contract_call, load_versioned } from "./helper";
@@ -13,19 +14,16 @@ import { contractPrincipalCV } from "@stacks/transactions/dist/clarity/types/pri
1314
describe("call functions with nested traits", () => {
1415
let orchestrator: DevnetNetworkOrchestrator;
1516
let network: StacksNetwork;
16-
const STACKS_2_1_EPOCH = 112;
1717

1818
let networkId: number;
1919

2020
beforeAll(() => {
2121
networkId = getNetworkIdFromEnv();
2222
console.log(`network #${networkId}`);
23-
orchestrator = buildDevnetNetworkOrchestrator(networkId, {
24-
epoch_2_0: 100,
25-
epoch_2_05: 102,
26-
epoch_2_1: STACKS_2_1_EPOCH,
27-
pox_2_activation: 120,
28-
});
23+
orchestrator = buildDevnetNetworkOrchestrator(
24+
networkId,
25+
EPOCH_TIMELINE_LONG_2_05,
26+
);
2927
orchestrator.start();
3028
network = new StacksTestnet({
3129
url: orchestrator.getStacksNodeUrl().replace("localhost", "127.0.0.1"),
@@ -77,14 +75,16 @@ describe("call functions with nested traits", () => {
7775

7876
// Make sure this we stayed in 2.05
7977
let chainInfo = await getChainInfo(network);
80-
expect(chainInfo.burn_block_height).toBeLessThanOrEqual(STACKS_2_1_EPOCH);
78+
expect(chainInfo.burn_block_height).toBeLessThanOrEqual(
79+
EPOCH_TIMELINE_LONG_2_05.epoch_2_1,
80+
);
8181
});
8282

8383
describe("in 2.1", () => {
8484
beforeAll(async () => {
8585
// Wait for 2.1 to go live
8686
await orchestrator.waitForStacksBlockAnchoredOnBitcoinBlockOfHeight(
87-
STACKS_2_1_EPOCH + 1,
87+
EPOCH_TIMELINE_LONG_2_05.epoch_2_1 + 1,
8888
);
8989
});
9090

Diff for: tests/integration/clarity/traits/call-nested-3-ok.spec.ts

+9-10
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,13 @@ import {
44
buildDevnetNetworkOrchestrator,
55
getNetworkIdFromEnv,
66
getChainInfo,
7+
EPOCH_TIMELINE_LONG_2_05,
78
} from "../../helpers";
89
import { DevnetNetworkOrchestrator } from "@hirosystems/stacks-devnet-js";
910
import { contract_call, load_versioned } from "./helper";
1011
import { responseOkCV } from "@stacks/transactions";
1112
import { contractPrincipalCV } from "@stacks/transactions/dist/clarity/types/principalCV";
1213

13-
const STACKS_2_1_EPOCH = 112;
14-
1514
describe("call functions with nested traits", () => {
1615
let orchestrator: DevnetNetworkOrchestrator;
1716
let network: StacksNetwork;
@@ -21,12 +20,10 @@ describe("call functions with nested traits", () => {
2120
beforeAll(() => {
2221
networkId = getNetworkIdFromEnv();
2322
console.log(`network #${networkId}`);
24-
orchestrator = buildDevnetNetworkOrchestrator(networkId, {
25-
epoch_2_0: 100,
26-
epoch_2_05: 102,
27-
epoch_2_1: STACKS_2_1_EPOCH,
28-
pox_2_activation: 120,
29-
});
23+
orchestrator = buildDevnetNetworkOrchestrator(
24+
networkId,
25+
EPOCH_TIMELINE_LONG_2_05,
26+
);
3027
orchestrator.start();
3128
network = new StacksTestnet({
3229
url: orchestrator.getStacksNodeUrl().replace("localhost", "127.0.0.1"),
@@ -78,14 +75,16 @@ describe("call functions with nested traits", () => {
7875

7976
// Make sure this we stayed in 2.05
8077
let chainInfo = await getChainInfo(network);
81-
expect(chainInfo.burn_block_height).toBeLessThanOrEqual(STACKS_2_1_EPOCH);
78+
expect(chainInfo.burn_block_height).toBeLessThanOrEqual(
79+
EPOCH_TIMELINE_LONG_2_05.epoch_2_1,
80+
);
8281
});
8382

8483
describe("in 2.1", () => {
8584
beforeAll(async () => {
8685
// Wait for 2.1 to go live
8786
await orchestrator.waitForStacksBlockAnchoredOnBitcoinBlockOfHeight(
88-
STACKS_2_1_EPOCH + 1,
87+
EPOCH_TIMELINE_LONG_2_05.epoch_2_1 + 1,
8988
);
9089
});
9190

Diff for: tests/integration/clarity/traits/call-nested-4.spec.ts

+9-9
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {
44
buildDevnetNetworkOrchestrator,
55
getNetworkIdFromEnv,
66
getChainInfo,
7+
EPOCH_TIMELINE_LONG_2_05,
78
} from "../../helpers";
89
import { DevnetNetworkOrchestrator } from "@hirosystems/stacks-devnet-js";
910
import { contract_call, load_versioned } from "./helper";
@@ -13,19 +14,16 @@ import { contractPrincipalCV } from "@stacks/transactions/dist/clarity/types/pri
1314
describe("call functions with nested traits", () => {
1415
let orchestrator: DevnetNetworkOrchestrator;
1516
let network: StacksNetwork;
16-
const STACKS_2_1_EPOCH = 112;
1717

1818
let networkId: number;
1919

2020
beforeAll(() => {
2121
networkId = getNetworkIdFromEnv();
2222
console.log(`network #${networkId}`);
23-
orchestrator = buildDevnetNetworkOrchestrator(networkId, {
24-
epoch_2_0: 100,
25-
epoch_2_05: 102,
26-
epoch_2_1: STACKS_2_1_EPOCH,
27-
pox_2_activation: 120,
28-
});
23+
orchestrator = buildDevnetNetworkOrchestrator(
24+
networkId,
25+
EPOCH_TIMELINE_LONG_2_05,
26+
);
2927
orchestrator.start();
3028
network = new StacksTestnet({
3129
url: orchestrator.getStacksNodeUrl().replace("localhost", "127.0.0.1"),
@@ -77,14 +75,16 @@ describe("call functions with nested traits", () => {
7775

7876
// Make sure this we stayed in 2.05
7977
let chainInfo = await getChainInfo(network);
80-
expect(chainInfo.burn_block_height).toBeLessThanOrEqual(STACKS_2_1_EPOCH);
78+
expect(chainInfo.burn_block_height).toBeLessThanOrEqual(
79+
EPOCH_TIMELINE_LONG_2_05.epoch_2_1,
80+
);
8181
});
8282

8383
describe("in 2.1", () => {
8484
beforeAll(async () => {
8585
// Wait for 2.1 to go live
8686
await orchestrator.waitForStacksBlockAnchoredOnBitcoinBlockOfHeight(
87-
STACKS_2_1_EPOCH + 1,
87+
EPOCH_TIMELINE_LONG_2_05.epoch_2_1 + 1,
8888
);
8989
});
9090

Diff for: tests/integration/clarity/traits/circular.spec.ts

+9-9
Original file line numberDiff line numberDiff line change
@@ -15,25 +15,23 @@ import {
1515
waitForStacksTransaction,
1616
getNetworkIdFromEnv,
1717
getChainInfo,
18+
EPOCH_TIMELINE_LONG_2_05,
1819
} from "../../helpers";
1920
import { DevnetNetworkOrchestrator } from "@hirosystems/stacks-devnet-js";
2021

2122
describe("use", () => {
2223
let orchestrator: DevnetNetworkOrchestrator;
2324
let network: StacksNetwork;
24-
const STACKS_2_1_EPOCH = 112;
2525

2626
let networkId: number;
2727

2828
beforeAll(() => {
2929
networkId = getNetworkIdFromEnv();
3030
console.log(`network #${networkId}`);
31-
orchestrator = buildDevnetNetworkOrchestrator(networkId, {
32-
epoch_2_0: 100,
33-
epoch_2_05: 102,
34-
epoch_2_1: STACKS_2_1_EPOCH,
35-
pox_2_activation: 120,
36-
});
31+
orchestrator = buildDevnetNetworkOrchestrator(
32+
networkId,
33+
EPOCH_TIMELINE_LONG_2_05,
34+
);
3735
orchestrator.start();
3836
network = new StacksTestnet({
3937
url: orchestrator.getStacksNodeUrl().replace("localhost", "127.0.0.1"),
@@ -59,7 +57,9 @@ describe("use", () => {
5957
afterAll(async () => {
6058
// Make sure this we stayed in 2.05
6159
let chainInfo = await getChainInfo(network);
62-
expect(chainInfo.burn_block_height).toBeLessThanOrEqual(STACKS_2_1_EPOCH);
60+
expect(chainInfo.burn_block_height).toBeLessThanOrEqual(
61+
EPOCH_TIMELINE_LONG_2_05.epoch_2_1,
62+
);
6363
});
6464

6565
it("publish a self-circular trait", async () => {
@@ -135,7 +135,7 @@ describe("use", () => {
135135
beforeAll(async () => {
136136
// Wait for 2.1 to go live
137137
await orchestrator.waitForStacksBlockAnchoredOnBitcoinBlockOfHeight(
138-
STACKS_2_1_EPOCH + 1,
138+
EPOCH_TIMELINE_LONG_2_05.epoch_2_1 + 1,
139139
);
140140
});
141141

Diff for: tests/integration/clarity/traits/double.spec.ts

+9-9
Original file line numberDiff line numberDiff line change
@@ -14,25 +14,23 @@ import {
1414
waitForStacksTransaction,
1515
getNetworkIdFromEnv,
1616
getChainInfo,
17+
EPOCH_TIMELINE_LONG_2_05,
1718
} from "../../helpers";
1819
import { DevnetNetworkOrchestrator } from "@hirosystems/stacks-devnet-js";
1920

2021
describe("use", () => {
2122
let orchestrator: DevnetNetworkOrchestrator;
2223
let network: StacksNetwork;
23-
const STACKS_2_1_EPOCH = 112;
2424

2525
let networkId: number;
2626

2727
beforeAll(() => {
2828
networkId = getNetworkIdFromEnv();
2929
console.log(`network #${networkId}`);
30-
orchestrator = buildDevnetNetworkOrchestrator(networkId, {
31-
epoch_2_0: 100,
32-
epoch_2_05: 102,
33-
epoch_2_1: STACKS_2_1_EPOCH,
34-
pox_2_activation: 120,
35-
});
30+
orchestrator = buildDevnetNetworkOrchestrator(
31+
networkId,
32+
EPOCH_TIMELINE_LONG_2_05,
33+
);
3634
orchestrator.start();
3735
network = new StacksTestnet({
3836
url: orchestrator.getStacksNodeUrl().replace("localhost", "127.0.0.1"),
@@ -52,7 +50,9 @@ describe("use", () => {
5250
afterAll(async () => {
5351
// Make sure this we stayed in 2.05
5452
let chainInfo = await getChainInfo(network);
55-
expect(chainInfo.burn_block_height).toBeLessThanOrEqual(STACKS_2_1_EPOCH);
53+
expect(chainInfo.burn_block_height).toBeLessThanOrEqual(
54+
EPOCH_TIMELINE_LONG_2_05.epoch_2_1,
55+
);
5656
});
5757

5858
it("define a trait with duplicate method names", async () => {
@@ -94,7 +94,7 @@ describe("use", () => {
9494
beforeAll(async () => {
9595
// Wait for 2.1 to go live
9696
await orchestrator.waitForStacksBlockAnchoredOnBitcoinBlockOfHeight(
97-
STACKS_2_1_EPOCH + 1,
97+
EPOCH_TIMELINE_LONG_2_05.epoch_2_1 + 1,
9898
);
9999
});
100100

Diff for: tests/integration/clarity/traits/empty.spec.ts

+9-9
Original file line numberDiff line numberDiff line change
@@ -15,25 +15,23 @@ import {
1515
waitForStacksTransaction,
1616
getNetworkIdFromEnv,
1717
getChainInfo,
18+
EPOCH_TIMELINE_LONG_2_05,
1819
} from "../../helpers";
1920
import { DevnetNetworkOrchestrator } from "@hirosystems/stacks-devnet-js";
2021

2122
describe("empty trait", () => {
2223
let orchestrator: DevnetNetworkOrchestrator;
2324
let network: StacksNetwork;
24-
const STACKS_2_1_EPOCH = 112;
2525

2626
let networkId: number;
2727

2828
beforeAll(() => {
2929
networkId = getNetworkIdFromEnv();
3030
console.log(`network #${networkId}`);
31-
orchestrator = buildDevnetNetworkOrchestrator(networkId, {
32-
epoch_2_0: 100,
33-
epoch_2_05: 102,
34-
epoch_2_1: STACKS_2_1_EPOCH,
35-
pox_2_activation: 120,
36-
});
31+
orchestrator = buildDevnetNetworkOrchestrator(
32+
networkId,
33+
EPOCH_TIMELINE_LONG_2_05,
34+
);
3735
orchestrator.start();
3836
network = new StacksTestnet({
3937
url: orchestrator.getStacksNodeUrl().replace("localhost", "127.0.0.1"),
@@ -50,7 +48,9 @@ describe("empty trait", () => {
5048
afterAll(async () => {
5149
// Make sure this we stayed in 2.05
5250
let chainInfo = await getChainInfo(network);
53-
expect(chainInfo.burn_block_height).toBeLessThanOrEqual(STACKS_2_1_EPOCH);
51+
expect(chainInfo.burn_block_height).toBeLessThanOrEqual(
52+
EPOCH_TIMELINE_LONG_2_05.epoch_2_1,
53+
);
5454
});
5555

5656
it("publish an empty trait", async () => {
@@ -126,7 +126,7 @@ describe("empty trait", () => {
126126
beforeAll(async () => {
127127
// Wait for 2.1 to go live
128128
await orchestrator.waitForStacksBlockAnchoredOnBitcoinBlockOfHeight(
129-
STACKS_2_1_EPOCH + 1,
129+
EPOCH_TIMELINE_LONG_2_05.epoch_2_1 + 1,
130130
);
131131
});
132132

0 commit comments

Comments
 (0)