-
-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
29 additions
and
0 deletions.
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
blockchain_integration/pi_network/PiShield/tests/pi-network.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
}); | ||
}); |