Files
lodestar/packages/beacon-node/test/unit/api/impl/config/config.test.ts
Nico Flaig 598c1ec54e feat: update networking config to match CL spec (#8510)
**Motivation**

Conform to CL spec

**Description**

- move networking constants to config
- remove constants no longer part of spec
- enable "p2p-interface.md" in config test

Closes https://github.com/ChainSafe/lodestar/issues/6351
Closes https://github.com/ChainSafe/lodestar/issues/7529
2025-10-13 14:44:41 +01:00

42 lines
1.5 KiB
TypeScript

import {beforeEach, describe, expect, it} from "vitest";
import {routes} from "@lodestar/api";
import {config} from "@lodestar/config/default";
import {getConfigApi, renderJsonSpec} from "../../../../../src/api/impl/config/index.js";
describe("config api implementation", () => {
let api: ReturnType<typeof getConfigApi>;
beforeEach(() => {
api = getConfigApi({config});
});
describe("getForkSchedule", () => {
it("should get known scheduled forks", async () => {
const {data: forkSchedule} = await api.getForkSchedule();
expect(forkSchedule.length).toBe(Object.keys(config.forks).length);
});
});
describe("getDepositContract", () => {
it("should get the deposit contract from config", async () => {
const {data: depositContract} = (await api.getDepositContract()) as {data: routes.config.DepositContract};
expect(depositContract.address).toBe(config.DEPOSIT_CONTRACT_ADDRESS);
expect(depositContract.chainId).toBe(config.DEPOSIT_CHAIN_ID);
});
});
describe("getSpec", () => {
it("Ensure spec can be rendered", () => {
renderJsonSpec(config);
});
it("should get the spec", async () => {
const {data: specJson} = (await api.getSpec()) as {data: routes.config.Spec};
expect(specJson.SECONDS_PER_ETH1_BLOCK).toBe("14");
expect(specJson.DEPOSIT_CONTRACT_ADDRESS).toBe("0x00000000219ab540356cbb839cbe05303d7705fa");
expect(specJson.DEPOSIT_REQUEST_TYPE).toBe("0x00");
});
});
});