Commit e94decd9 authored by Rosco Kalis's avatar Rosco Kalis

Add cSpell config and fix spelling

parent 880fb06a
Pipeline #212268569 passed with stages
in 2 minutes and 43 seconds
{
"version": "0.1",
"import": ["node_modules/@generalprotocols/cspell-dictionary/cspell.json"]
}
......@@ -2,3 +2,6 @@ node_modules/
.nyc_output/
dist/
coverage/
.vscode
yarn.lock
yarn-error.log
......@@ -18,6 +18,11 @@ eslint:
script:
- npm run lint
spellcheck:
stage: lint
script:
- npm run spellcheck
ava:
stage: test
script:
......
......@@ -16,9 +16,9 @@
*/
/**
* Tuple of a topic andmessage content for distribution over ZeroMQ
* Tuple of a topic and message content for distribution over ZeroMQ
* @typedef {[ Uint8Array, Uint8Array ]} ZeroMQMessage
*/
// Add empty exports so that JSDoc can access these typedefs
// Add empty exports so that JSDoc can access these type definitions
module.exports = {};
......@@ -28,7 +28,7 @@ export class OracleNetwork
// Initialize a packet counter.
this.packetCounter = 0;
// Continously receive packets forever.
// Continuously receive packets forever.
// eslint-disable-next-line no-constant-condition
while(true)
{
......@@ -41,7 +41,7 @@ export class OracleNetwork
// Increase the packet counter.
this.packetCounter += 1;
// Log that we have reveived a packet.
// Log that we have received a packet.
debug.network(`Received packet #${this.packetCounter} with topic ${topic}.`);
debug.object(content);
......@@ -72,7 +72,7 @@ export class OracleNetwork
// Initialize a request counter.
this.requestCounter = 0;
// Continously receive packets forever.
// Continuously receive packets forever.
// eslint-disable-next-line no-constant-condition
while(true)
{
......@@ -85,7 +85,7 @@ export class OracleNetwork
// Increase the request counter.
this.requestCounter += 1;
// Log that we have reveived a request.
// Log that we have received a request.
debug.network(`Received request #${this.requestCounter}.`);
debug.object(content);
......@@ -352,7 +352,7 @@ export class OracleNetwork
}
/**
* Creates and intializes an incoming request socket.
* Creates and initializes an incoming request socket.
*
* @param callback {function} a function that will handle incoming requests, taking content as function parameter.
* @param address {string} a hostname or IP address which the request socket will bind to.
......@@ -389,7 +389,7 @@ export class OracleNetwork
/**
* Sends a request for data to an oracle peer.
*
* @param content {any} the request content, as a JSON stringifiable entity.
* @param content {any} the request content, as an entity that can be JSON stringified.
* @param address {string} a hostname or IP address which to send the request to.
* @param port {number} a port number which the request will be sent on.
*
......
......@@ -16,6 +16,7 @@
"rename-namespace": "replace 'namespace' 'declare namespace' dist/typings/index.d.ts",
"lint": "eslint .",
"rollup": "rollup -c",
"spellcheck": "cspell '**'",
"test": "npm run build && c8 ava --timeout='60s' tests/*.js"
},
"repository": {
......@@ -43,11 +44,13 @@
"zeromq": "^6.0.0-beta.6"
},
"devDependencies": {
"@generalprotocols/cspell-dictionary": "git+https://gitlab.com/GeneralProtocols/cspell-dictionary.git",
"@generalprotocols/eslint-config": "git+https://gitlab.com/GeneralProtocols/eslint-config.git",
"@types/debug": "^4.1.5",
"@typescript-eslint/eslint-plugin": "^4.6.0",
"ava": "^3.13.0",
"c8": "^7.3.5",
"cspell": "4.1.2",
"del-cli": "^3.0.1",
"eslint": "^7.12.1",
"eslint-plugin-import": "^2.22.1",
......
......@@ -59,7 +59,7 @@ const runTests = async function()
// Craft a price message from the example data.
const craftedMessage = await OracleData.createPriceMessage(example.data.price, example.data.blockHeight, example.data.blockHash, example.data.blockSequence, example.data.oracleSequence, example.data.timestamp);
// Verify that created price message matches expections.
// Verify that created price message matches expectations.
t.deepEqual(craftedMessage, example.message, 'Crafted message should not change when the message properties is not changed.');
};
......@@ -68,7 +68,7 @@ const runTests = async function()
// Parse the example price message.
const parsedMessage = await OracleData.parsePriceMessage(example.message);
// Verify that the parsed message matches the expections.
// Verify that the parsed message matches the expectations.
t.deepEqual(parsedMessage, example.data, 'Parsed message properties should not change when the message is not changed.');
};
......@@ -77,7 +77,7 @@ const runTests = async function()
// Sign the example message.
const signature = await OracleData.signMessage(example.message, oraclePrivateKeyWIF);
// Verify that the signature matches the expections.
// Verify that the signature matches the expectations.
t.deepEqual(signature, example.signature, 'Message signature should not change when message and signature is not changed.');
};
......@@ -145,7 +145,7 @@ const runTests = async function()
{
try
{
// Try to parse an intentionally unsufficiently long message.
// Try to parse an intentionally insufficiently long message.
await OracleData.parsePriceMessage(hexToBin('01'));
}
catch(error)
......@@ -158,7 +158,7 @@ const runTests = async function()
// Define normal test cases.
const normalTests = async function()
{
// Test top-level non-stubbed library functions in parallell with the current usecase.
// Test top-level non-stubbed library functions in parallel with the current use case.
test('Create oracle message', testCreateMessage);
test('Parse oracle message', testParseMessage);
test('Sign oracle message', testSignMessage);
......@@ -170,7 +170,7 @@ const runTests = async function()
// Define invalid test cases.
const failureTests = async function()
{
// Test top-level non-stubbed library functions in parallell with the current usecase.
// Test top-level non-stubbed library functions in parallel with the current use case.
test('Fail on missing signature.', failMissingSignature);
test('Fail on invalid signature.', failInvalidSignature);
test('Fail on too short message', failMessageTooShort);
......@@ -180,7 +180,7 @@ const runTests = async function()
// Run normal behaviour test cases.
normalTests();
// Run test cases that verify failure behaviours.
// Run test cases that verify failure behaviors.
failureTests();
};
......
......@@ -114,7 +114,7 @@ const runTests = async function()
// Define normal test cases.
const normalTests = async function()
{
// Test top-level non-stubbed library functions in parallell with the current usecase.
// Test top-level non-stubbed library functions in parallel with the current use case.
test('Broadcast a signed oracle message', testBroadcasting);
test('Relay a signed oracle message', testRelaying);
test('Request a ping response', testRequesting);
......@@ -123,13 +123,13 @@ const runTests = async function()
// Define invalid test cases.
const failureTests = async function()
{
// Test top-level non-stubbed library functions in parallell with the current usecase.
// Test top-level non-stubbed library functions in parallel with the current use case.
};
// Run normal behaviour test cases.
normalTests();
// Run test cases that verify failure behaviours.
// Run test cases that verify failure behaviors.
failureTests();
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment