Skip to content

Commit bcf22fa

Browse files
committed
chore(test): remove bun imports
1 parent 5652cad commit bcf22fa

File tree

8 files changed

+117
-130
lines changed

8 files changed

+117
-130
lines changed

packages/networks/src/lib/networks/vNaga/common/LitChainClient/apis/highLevelApis/PKPPermissionsManager/PKPPermissionsManager.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { beforeAll, describe, expect, test } from "bun:test";
21
import { networkContext } from "../../../_config";
32
import { PKPPermissionsManager } from "./PKPPermissionsManager";
43

packages/networks/src/lib/networks/vNaga/common/LitChainClient/apis/highLevelApis/connection/getConnectionInfo.spec.ts

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,29 @@
1-
import { beforeAll, describe, expect, test } from "bun:test";
2-
import { networkContext, NetworkContext } from "../../../_config";
3-
import { getConnectionInfo } from "./getConnectionInfo";
1+
import { networkContext, NetworkContext } from '../../../_config';
2+
import { getConnectionInfo } from './getConnectionInfo';
43

5-
describe("ConnectionInfo", () => {
4+
describe('ConnectionInfo', () => {
65
let networkCtx: NetworkContext;
76

87
beforeAll(async () => {
98
networkCtx = networkContext;
109
});
1110

12-
test("getConnectionInfo returns properly formatted connection data", async () => {
11+
test('getConnectionInfo returns properly formatted connection data', async () => {
1312
const connectionInfo = await getConnectionInfo({
1413
networkCtx,
1514
});
1615

1716
// Verify the structure and data types
18-
expect(connectionInfo).toHaveProperty("epochInfo");
19-
expect(connectionInfo).toHaveProperty("minNodeCount");
20-
expect(connectionInfo).toHaveProperty("bootstrapUrls");
17+
expect(connectionInfo).toHaveProperty('epochInfo');
18+
expect(connectionInfo).toHaveProperty('minNodeCount');
19+
expect(connectionInfo).toHaveProperty('bootstrapUrls');
2120

2221
// Verify the epochInfo structure
23-
expect(connectionInfo.epochInfo).toHaveProperty("epochLength");
24-
expect(connectionInfo.epochInfo).toHaveProperty("number");
25-
expect(connectionInfo.epochInfo).toHaveProperty("endTime");
26-
expect(connectionInfo.epochInfo).toHaveProperty("retries");
27-
expect(connectionInfo.epochInfo).toHaveProperty("timeout");
22+
expect(connectionInfo.epochInfo).toHaveProperty('epochLength');
23+
expect(connectionInfo.epochInfo).toHaveProperty('number');
24+
expect(connectionInfo.epochInfo).toHaveProperty('endTime');
25+
expect(connectionInfo.epochInfo).toHaveProperty('retries');
26+
expect(connectionInfo.epochInfo).toHaveProperty('timeout');
2827

2928
// Verify data types and ranges
3029
expect(connectionInfo.minNodeCount).toBeGreaterThanOrEqual(1);
@@ -34,14 +33,14 @@ describe("ConnectionInfo", () => {
3433

3534
// Verify that all URLs start with http:// or https://
3635
connectionInfo.bootstrapUrls.forEach((url) => {
37-
expect(url.startsWith("http://") || url.startsWith("https://")).toBe(
36+
expect(url.startsWith('http://') || url.startsWith('https://')).toBe(
3837
true
3938
);
4039
});
4140
});
4241

43-
test("getConnectionInfo applies custom protocol when provided", async () => {
44-
const customProtocol = "https://";
42+
test('getConnectionInfo applies custom protocol when provided', async () => {
43+
const customProtocol = 'https://';
4544
const connectionInfo = await getConnectionInfo({
4645
networkCtx,
4746
nodeProtocol: customProtocol,
Lines changed: 28 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,49 @@
1-
import { beforeAll, describe, expect, test } from "bun:test";
2-
import { networkContext, NetworkContext } from "../../../_config";
3-
import { mintPKP } from "./mintPKP";
1+
import { networkContext, NetworkContext } from '../../../_config';
2+
import { mintPKP } from './mintPKP';
43

5-
describe("mintPKP", () => {
4+
describe('mintPKP', () => {
65
let networkCtx: NetworkContext;
76

87
beforeAll(() => {
98
networkCtx = networkContext;
109
});
1110

12-
test("should mint PKP with customAuthMethodId and return correct data format", async () => {
11+
test('should mint PKP with customAuthMethodId and return correct data format', async () => {
1312
const res = await mintPKP(
1413
{
1514
authMethod: {
1615
authMethodType: 1,
17-
accessToken: "0x",
16+
accessToken: '0x',
1817
},
19-
scopes: ["sign-anything"],
20-
customAuthMethodId: "app-id-xxx:user-id-yyy",
18+
scopes: ['sign-anything'],
19+
customAuthMethodId: 'app-id-xxx:user-id-yyy',
2120
},
2221
networkCtx
2322
);
2423

2524
// Check response structure
26-
expect(res).toHaveProperty("hash");
27-
expect(res).toHaveProperty("receipt");
28-
expect(res).toHaveProperty("data");
29-
expect(res.data).toHaveProperty("tokenId");
30-
expect(res.data).toHaveProperty("pubkey");
31-
expect(res.data).toHaveProperty("ethAddress");
25+
expect(res).toHaveProperty('hash');
26+
expect(res).toHaveProperty('receipt');
27+
expect(res).toHaveProperty('data');
28+
expect(res.data).toHaveProperty('tokenId');
29+
expect(res.data).toHaveProperty('pubkey');
30+
expect(res.data).toHaveProperty('ethAddress');
3231

3332
// Verify data types
34-
expect(typeof res.data.tokenId).toBe("bigint");
35-
expect(typeof res.data.pubkey).toBe("string");
36-
expect(typeof res.data.ethAddress).toBe("string");
33+
expect(typeof res.data.tokenId).toBe('bigint');
34+
expect(typeof res.data.pubkey).toBe('string');
35+
expect(typeof res.data.ethAddress).toBe('string');
3736
expect(res.data.pubkey).toMatch(/^0x/);
3837
expect(res.data.ethAddress).toMatch(/^0x/);
3938
});
4039

41-
test("show auto-convert native authMethod to authMethodId when customAuthMethodId is omitted", async () => {
40+
test('show auto-convert native authMethod to authMethodId when customAuthMethodId is omitted', async () => {
4241
const eoaAuthSig = {
43-
sig: "",
44-
derivedVia: "web3.eth.personal.sign",
42+
sig: '',
43+
derivedVia: 'web3.eth.personal.sign',
4544
signedMessage:
46-
"I am creating an account to use Lit Protocol at 2022-04-12T09:23:31.290Z",
47-
address: "0x7e7763BE1379Bb48AFEE4F5c232Fb67D7c03947F",
45+
'I am creating an account to use Lit Protocol at 2022-04-12T09:23:31.290Z',
46+
address: '0x7e7763BE1379Bb48AFEE4F5c232Fb67D7c03947F',
4847
};
4948

5049
const res = await mintPKP(
@@ -53,24 +52,24 @@ describe("mintPKP", () => {
5352
authMethodType: 1,
5453
accessToken: JSON.stringify(eoaAuthSig),
5554
},
56-
scopes: ["sign-anything"],
55+
scopes: ['sign-anything'],
5756
},
5857
networkCtx
5958
);
6059

6160
// Find relevant events in decoded logs
6261
const permittedAuthMethodScopeAddedEvent = res.decodedLogs.find(
63-
(log) => log.eventName === "PermittedAuthMethodScopeAdded"
62+
(log) => log.eventName === 'PermittedAuthMethodScopeAdded'
6463
);
6564
const permittedAuthMethodAddedEvent = res.decodedLogs.find(
66-
(log) => log.eventName === "PermittedAuthMethodAdded"
65+
(log) => log.eventName === 'PermittedAuthMethodAdded'
6766
);
6867

69-
expect(permittedAuthMethodScopeAddedEvent?.args.id).toBe(
70-
"0x4cb822e6f51d9723f22b9374c4ef7d41ae2b1a5463738516aeb117ff387ba51a"
68+
expect(permittedAuthMethodScopeAddedEvent?.args['id']).toBe(
69+
'0x4cb822e6f51d9723f22b9374c4ef7d41ae2b1a5463738516aeb117ff387ba51a'
7170
);
72-
expect(permittedAuthMethodAddedEvent?.args.id).toBe(
73-
"0x4cb822e6f51d9723f22b9374c4ef7d41ae2b1a5463738516aeb117ff387ba51a"
71+
expect(permittedAuthMethodAddedEvent?.args['id']).toBe(
72+
'0x4cb822e6f51d9723f22b9374c4ef7d41ae2b1a5463738516aeb117ff387ba51a'
7473
);
7574
});
7675
});

packages/networks/src/lib/networks/vNaga/common/LitChainClient/apis/highLevelApis/priceFeed/priceFeedApi.spec.ts

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,42 @@
1-
import { beforeAll, describe, expect, test } from "bun:test";
2-
import { networkContext, NetworkContext } from "../../../_config";
3-
import { getNodePrices, getPriceFeedInfo } from "./priceFeedApi";
1+
import { networkContext, NetworkContext } from '../../../_config';
2+
import { getNodePrices, getPriceFeedInfo } from './priceFeedApi';
43

5-
describe("priceFeedApi", () => {
4+
describe('priceFeedApi', () => {
65
let networkCtx: NetworkContext;
76

87
beforeAll(() => {
98
networkCtx = networkContext;
109
});
1110

12-
test("getPriceFeedInfo should return data in the correct format", async () => {
11+
test('getPriceFeedInfo should return data in the correct format', async () => {
1312
const priceInfo = await getPriceFeedInfo({
1413
networkCtx,
1514
});
1615

1716
// Check response structure
18-
expect(priceInfo).toHaveProperty("epochId");
19-
expect(priceInfo).toHaveProperty("minNodeCount");
20-
expect(priceInfo).toHaveProperty("networkPrices");
17+
expect(priceInfo).toHaveProperty('epochId');
18+
expect(priceInfo).toHaveProperty('minNodeCount');
19+
expect(priceInfo).toHaveProperty('networkPrices');
2120

2221
// Check that networkPrices is an array
2322
expect(Array.isArray(priceInfo.networkPrices)).toBe(true);
2423

2524
// Check structure of first network price entry if available
2625
if (priceInfo.networkPrices.length > 0) {
2726
const firstPrice = priceInfo.networkPrices[0];
28-
expect(firstPrice).toHaveProperty("url");
29-
expect(firstPrice).toHaveProperty("prices");
30-
expect(typeof firstPrice.url).toBe("string");
27+
expect(firstPrice).toHaveProperty('url');
28+
expect(firstPrice).toHaveProperty('prices');
29+
expect(typeof firstPrice.url).toBe('string');
3130
expect(Array.isArray(firstPrice.prices)).toBe(true);
3231

3332
// Check that prices are bigints
3433
if (firstPrice.prices.length > 0) {
35-
expect(typeof firstPrice.prices[0]).toBe("bigint");
34+
expect(typeof firstPrice.prices[0]).toBe('bigint');
3635
}
3736
}
3837
});
3938

40-
test("getNodePrices should return data in the correct format", async () => {
39+
test('getNodePrices should return data in the correct format', async () => {
4140
const prices = await getNodePrices({
4241
networkCtx,
4342
});
@@ -48,14 +47,14 @@ describe("priceFeedApi", () => {
4847
// Check structure of first price entry if available
4948
if (prices.length > 0) {
5049
const firstPrice = prices[0];
51-
expect(firstPrice).toHaveProperty("url");
52-
expect(firstPrice).toHaveProperty("prices");
53-
expect(typeof firstPrice.url).toBe("string");
50+
expect(firstPrice).toHaveProperty('url');
51+
expect(firstPrice).toHaveProperty('prices');
52+
expect(typeof firstPrice.url).toBe('string');
5453
expect(Array.isArray(firstPrice.prices)).toBe(true);
5554

5655
// Check that prices are bigints
5756
if (firstPrice.prices.length > 0) {
58-
expect(typeof firstPrice.prices[0]).toBe("bigint");
57+
expect(typeof firstPrice.prices[0]).toBe('bigint');
5958
}
6059
}
6160
});
Lines changed: 29 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,36 @@
1-
import { beforeAll, describe, expect, test } from "bun:test";
2-
import {
3-
networkContext,
4-
NetworkContext,
5-
} from "../../../_config";
6-
import { CallExecutionError, ContractFunctionRevertedError } from "viem";
7-
import { claimAndMint } from "./claimAndMint";
8-
import { createLitContracts } from "../../../utils/createLitContracts";
9-
import { ClaimAndMintSchema } from "../../../../schemas/ClaimAndMintSchema";
1+
import { CallExecutionError, ContractFunctionRevertedError } from 'viem';
2+
import { networkContext, NetworkContext } from '../../../../_config';
3+
import { ClaimAndMintSchema } from '../../../../schemas/ClaimAndMintSchema';
4+
import { createLitContracts } from '../../../utils/createLitContracts';
5+
import { claimAndMint } from './claimAndMint';
106

11-
describe("LitChainClient", () => {
7+
describe('LitChainClient', () => {
128
let networkCtx: NetworkContext;
139

1410
beforeAll(async () => {
1511
networkCtx = networkContext;
1612
});
1713

18-
test("claimAndMint", async () => {
14+
test('claimAndMint', async () => {
1915
try {
2016
const tx = await claimAndMint(
2117
{
2218
derivedKeyId:
23-
"4d90d864b5f6adb1dd8ef5fbfc3d7ca74f6dd973f8c52ce12f8ce61aa6a1dfa4",
19+
'4d90d864b5f6adb1dd8ef5fbfc3d7ca74f6dd973f8c52ce12f8ce61aa6a1dfa4',
2420
signatures: [
2521
{
26-
r: "0xcc544fa05678fddff726ec2070bf0c4d2862e35f26ab74baede84dfdf117c841",
27-
s: "0x2286aef0cd151175c63116cd622df3ea7bb8113982525ac07c0bd50d33ee7136",
22+
r: '0xcc544fa05678fddff726ec2070bf0c4d2862e35f26ab74baede84dfdf117c841',
23+
s: '0x2286aef0cd151175c63116cd622df3ea7bb8113982525ac07c0bd50d33ee7136',
2824
v: 27,
2925
},
3026
{
31-
r: "0x7b2bbef14e4e277abe1ebb16e6803a4192c7157f2a7e190c6651b27d2b8eb98b",
32-
s: "0x149d547cc36f1b996afa799c854fbe8776290864d22677e57f4fbbfac952f728",
27+
r: '0x7b2bbef14e4e277abe1ebb16e6803a4192c7157f2a7e190c6651b27d2b8eb98b',
28+
s: '0x149d547cc36f1b996afa799c854fbe8776290864d22677e57f4fbbfac952f728',
3329
v: 28,
3430
},
3531
{
36-
r: "0x59459b3830a4f5b365270a7cf559a8a4a8c90f348a68544e64fac3ed22190ad3",
37-
s: "0x4d2bf3d3a9520fa205a60b6031aea84c5fe788fb5198a4a453fb9e20acb05488",
32+
r: '0x59459b3830a4f5b365270a7cf559a8a4a8c90f348a68544e64fac3ed22190ad3',
33+
s: '0x4d2bf3d3a9520fa205a60b6031aea84c5fe788fb5198a4a453fb9e20acb05488',
3834
v: 28,
3935
},
4036
],
@@ -62,28 +58,28 @@ describe("LitChainClient", () => {
6258
const reason = (
6359
(error as CallExecutionError).cause as ContractFunctionRevertedError
6460
).reason;
65-
expect(reason).toBe("PubkeyRouter: pubkey already has routing data");
61+
expect(reason).toBe('PubkeyRouter: pubkey already has routing data');
6662
}
6763
});
6864

69-
test("simulate claimAndMint", async () => {
65+
test('simulate claimAndMint', async () => {
7066
const validatedRequest = ClaimAndMintSchema.parse({
7167
derivedKeyId:
72-
"fa9c79fc322d407c2b1f9e1589edd444c95bbadf4baf1f3a2863d33ee1ff7ab4",
68+
'fa9c79fc322d407c2b1f9e1589edd444c95bbadf4baf1f3a2863d33ee1ff7ab4',
7369
signatures: [
7470
{
75-
r: "0x87446889e5e551d88e968788d4f9651adcff0d2f4188ea9a27fe5d2436ddea9b",
76-
s: "0x132ff3bdb078365c83bb5d24ee2c05408155b24234b39b962c8321a82d0c1f7f",
71+
r: '0x87446889e5e551d88e968788d4f9651adcff0d2f4188ea9a27fe5d2436ddea9b',
72+
s: '0x132ff3bdb078365c83bb5d24ee2c05408155b24234b39b962c8321a82d0c1f7f',
7773
v: 27,
7874
},
7975
{
80-
r: "0xb15a8ed3a10f919301307ef463a72d40079c163107f43393cbf65701c73902de",
81-
s: "0x20a4f1469c935363ac9cea5a7c5b65ffbd8f37c5d48be5c2e15966c9bbddde06",
76+
r: '0xb15a8ed3a10f919301307ef463a72d40079c163107f43393cbf65701c73902de',
77+
s: '0x20a4f1469c935363ac9cea5a7c5b65ffbd8f37c5d48be5c2e15966c9bbddde06',
8278
v: 27,
8379
},
8480
{
85-
r: "0x97dee43dfbf3be22bc530e5322b33bf6a571d15c234e3d2251207d6c888bf140",
86-
s: "0x7cfab33b2d4a9140089d2f0a4178b5fad0725fef4b6335741684f99715539bd1",
81+
r: '0x97dee43dfbf3be22bc530e5322b33bf6a571d15c234e3d2251207d6c888bf140',
82+
s: '0x7cfab33b2d4a9140089d2f0a4178b5fad0725fef4b6335741684f99715539bd1',
8783
v: 27,
8884
},
8985
],
@@ -94,20 +90,18 @@ describe("LitChainClient", () => {
9490

9591
const mintCost = await pkpNftContract.read.mintCost();
9692

93+
const REALM_ID = 1n;
9794
const result = await publicClient.simulateContract({
9895
address: pkpNftContract.address,
9996
abi: pkpNftContract.abi,
100-
functionName: "claimAndMint",
101-
args: [
102-
2n,
103-
derivedKeyId,
104-
signatures,
105-
stakingContract.address,
106-
],
97+
functionName: 'claimAndMint',
98+
args: [REALM_ID, 2n, derivedKeyId, signatures, stakingContract.address],
10799
value: mintCost,
108100
account: walletClient.account!,
109101
});
110102

111-
expect(result.result).toBe(39540774701362869188416741706549054806716702330527798538695592469657559009284n);
103+
expect(result.result).toBe(
104+
39540774701362869188416741706549054806716702330527798538695592469657559009284n
105+
);
112106
});
113107
});

0 commit comments

Comments
 (0)