Skip to content

Commit

Permalink
Create pi-network.test.js
Browse files Browse the repository at this point in the history
  • Loading branch information
KOSASIH authored Aug 8, 2024
1 parent 35795dc commit f1b8c4d
Showing 1 changed file with 29 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// tests/pi-network.test.js

const { PiNetwork } = require('../pi-network');
const { expect } = require('chai');

describe('Pi Network', () => {
let piNetwork;

beforeEach(() => {
piNetwork = new PiNetwork();
});

it('should create a new Pi Network with a set of nodes', () => {
expect(piNetwork.nodes).to.be.an('array');
expect(piNetwork.nodes).to.have.lengthOf(10);
});

it('should add new nodes to the network', async () => {
const newNode = new Node();
await piNetwork.addNode(newNode);
expect(piNetwork.nodes).to.include(newNode);
});

it('should remove nodes from the network', async () => {
const nodeToRemove = piNetwork.nodes[0];
await piNetwork.removeNode(nodeToRemove);
expect(piNetwork.nodes).not.to.include(nodeToRemove);
});
});

0 comments on commit f1b8c4d

Please sign in to comment.