Skip to content

Commit

Permalink
correct test to not stop the node so we can test its configs properly
Browse files Browse the repository at this point in the history
  • Loading branch information
Rinse12 committed Nov 2, 2024
1 parent 2c8a023 commit c238138
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions test/node-and-browser/plebbit.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,18 @@ describe("Plebbit options", async () => {
});

it(`Plebbit({ipfsHttpClientOptions, httpRoutersOptions}) will change config of ipfs node`, async () => {
const onlineIpfsNode = "http://localhost:15006/api/v0";
const nodeForHttpRouter = "http://localhost:15006/api/v0";
// default list of http routers to use
const httpRouterUrls = ["https://routing.lol", "https://peers.pleb.bot"];

const plebbit = await Plebbit({ ipfsHttpClientsOptions: [onlineIpfsNode], httpRoutersOptions: httpRouterUrls });
const plebbit = await Plebbit({ ipfsHttpClientsOptions: [nodeForHttpRouter], httpRoutersOptions: httpRouterUrls });

plebbit.clients.ipfsClients[nodeForHttpRouter]._client.stop = () => {};
expect(plebbit.httpRoutersOptions).to.deep.equal(httpRouterUrls);

await new Promise((resolve) => setTimeout(resolve, 2000));
const ipfsClient = plebbit.clients.ipfsClients[onlineIpfsNode]._client;

const ipfsClient = plebbit.clients.ipfsClients[nodeForHttpRouter]._client;
const configValueType = await ipfsClient.config.get("Routing.Type");
expect(configValueType).to.equal("custom");

Expand Down

0 comments on commit c238138

Please sign in to comment.