New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

napi-bindings

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

napi-bindings - npm Package Compare versions

Comparing version 1.1.2 to 4.1.0

bin/napi-net.dylib

112

package.json
{
"name": "napi-bindings",
"description": "Nymi API bindings to work with Nymi SDK 4.x",
"version": "1.1.2",
"version": "4.1.0",
"license": "Apache-2.0",

@@ -13,7 +13,7 @@ "keywords": [

"dependencies": {
"ffi": "^2.2.0",
"ref-struct": "^1.1.0"
"ffi": "~2.2.0",
"ref": "~1.3.4"
},
"devDependencies": {
"nodeunit": "^0.11.0"
"nodeunit": "~0.11.0"
},

@@ -29,5 +29,5 @@ "repository": {

"scripts": {
"postinstall": "node-gyp clean",
"clean": "node-gyp clean && rm -f bin/*.dylib && rm -f bin/*.dll",
"test": "node tests/index.js"
"postinstall": "node src/cleanup.js",
"test": "node tests/index.js",
"test-functional": "node tests/index.js functional"
},

@@ -46,24 +46,36 @@ "engines": {

"rules": {
"require-jsdoc": ["error", {
"require": {
"FunctionDeclaration": true,
"MethodDefinition": true,
"ClassDeclaration": false,
"ArrowFunctionExpression": false
"require-jsdoc": [
"error",
{
"require": {
"FunctionDeclaration": true,
"MethodDefinition": true,
"ClassDeclaration": false,
"ArrowFunctionExpression": false
}
}
}],
"max-len" : ["error", {
"code": 120,
"tabWidth": 4,
"ignoreComments": true
}],
"valid-jsdoc": ["error", {
"requireReturn": true,
"matchDescription": ".+",
"requireParamDescription": false,
"requireReturnDescription": false
}],
"no-trailing-spaces": ["error", {
"skipBlankLines": false
}],
],
"max-len": [
"error",
{
"code": 120,
"tabWidth": 4,
"ignoreComments": true
}
],
"valid-jsdoc": [
"error",
{
"requireReturn": true,
"matchDescription": ".+",
"requireParamDescription": false,
"requireReturnDescription": false
}
],
"no-trailing-spaces": [
"error",
{
"skipBlankLines": false
}
],
"no-bitwise": "off",

@@ -74,6 +86,12 @@ "camelcase": "error",

"guard-for-in": "error",
"wrap-iife": ["error", "any"],
"no-use-before-define": ["error", {
"functions": false
}],
"wrap-iife": [
"error",
"any"
],
"no-use-before-define": [
"error",
{
"functions": false
}
],
"new-cap": "error",

@@ -83,13 +101,29 @@ "no-caller": "error",

"no-new": "error",
"quotes": ["error", "single"],
"quotes": [
"error",
"single"
],
"no-undef": "error",
"no-unused-vars": "error",
"strict": ["error", "global"],
"no-cond-assign": ["error", "except-parens"],
"comma-style": ["error", "last"],
"indent": ["error", 4, {
"SwitchCase": 1
}]
"strict": [
"error",
"global"
],
"no-cond-assign": [
"error",
"except-parens"
],
"comma-style": [
"error",
"last"
],
"indent": [
"error",
4,
{
"SwitchCase": 1
}
]
}
}
}
# node-napi-bindings
Simple Node bindings for the Nymi API (NAPI) 4.0.
Simple Node bindings for the Nymi API (NAPI) 4.1.

@@ -7,5 +7,5 @@ Please refer to the official [Nymi Github](https://github.com/Nymi/JSON-API) or [SDK Documentation](https://downloads.nymi.com/sdkDoc/latest/index.html) for details.

## Support
All Platforms supported by the Nymi SDK 4.0 should be supported by this module.
All Platforms supported by the Nymi SDK 4.1 should be supported by this module.
Tested on Windows 7 64bit and macOS Sierra 10.12.2.
Tested on Windows 7 64bit, macOS Sierra 10.12.2, macOS Sierra 10.12.3 and macOS Sierra 10.12.4.

@@ -26,16 +26,5 @@ ##### Apple Mac OS

## Prerequisite
Create a file in the root directory of your project named `config.json` with the following content.
````json
{
"neaName" : "sample",
"sigAlgorithm" : "NIST256P",
"automaticFirmwareVersion" : false
}
````
## Versioning
As of Nymi API SDK 4.1 i decided to version the bindings accordingly.
## Breaking changes in 1.1.0
To get a better usability like autocomplete and JSDoc documentation
i had to change some things around. The example below is changed accordingly.
## Example

@@ -46,4 +35,5 @@ This example will initialize the NAPI, request info about all provisioned Nymi Bands and print the result.

````javascript
const NapiBinding = require('../src/index.js'),
napi = new NapiBinding(true); // true for using Nymulator or false for using physical Nymi Band (default: false)
const
NapiBinding = require('napi-bindings'),
napi = new NapiBinding(true); // true for using Nymulator or false for using physical Nymi Band (default: false)

@@ -53,19 +43,19 @@ try {

init = napi.jsonNapiConfigureD(__dirname, NapiBinding.LogLevel.NORMAL, 9088, '127.0.0.1');
init = napi.napiConfigure('NeaTest', '.', '{}', NapiBinding.LogLevel.NONE, 9088, '127.0.0.1');
console.assert(init === NapiBinding.ConfigOutcome.OKAY, 'INIT: %s', Object.keys(NapiBinding.ConfigOutcome)[init]);
put = napi.jsonNapiPutD(JSON.stringify({path: 'info/get', exchange: 'provisions'}));
put = napi.napiPut({path: 'info/get'});
console.assert(put === NapiBinding.JsonPutOutcome.OKAY, 'PUT: %s', Object.keys(NapiBinding.JsonPutOutcome)[put]);
console.assert(put === NapiBinding.PutOutcome.OKAY, 'PUT: %s', Object.keys(NapiBinding.PutOutcome)[put]);
get = napi.jsonNapiGetD();
get = napi.napiGet();
console.assert(get.outcome === NapiBinding.JsonGetOutcome.OKAY, 'GET: %s', Object.keys(NapiBinding.JsonGetOutcome)[get]);
console.log(JSON.parse(get.message));
console.assert(get.outcome === NapiBinding.GetOutcome.OKAY, 'GET: %s', Object.keys(NapiBinding.GetOutcome)[get]);
console.log(get.json);
} catch(err) {
console.error(err.message);
} finally {
napi.jsonNapiTerminateD();
napi.napiTerminate();
}

@@ -72,0 +62,0 @@ ````

@@ -5,18 +5,20 @@ 'use strict';

FFI = require('ffi'),
Struct = require('ref-struct'),
path = require('path'),
ref = require('ref'),
/**
* @typedef LogLevel
* @type {object}
* @property {int} NORMAL Limited logging of important events like errors and warnings. The default log level.
* @property {int} INFO Log significantly more information about the internals of NAPI.
* @property {int} NONE No logging.
* @property {int} NORMAL Normal logging of important events like errors and warnings. The default log level.
* @property {int} INFO Logs significantly more information about the internals of NAPI.
* @property {int} DEBUG The log level that will likely be used when working with Nymi Support.
* @property {int} VERBOSE Log pretty much everything down to the Bluetooth level.
* @property {int} VERBOSE Logs pretty much everything down to the Bluetooth level.
* @constant
*/
LogLevel = {
NORMAL: 0,
INFO: 1,
DEBUG: 2,
VERBOSE: 3
NONE: 0,
NORMAL: 1,
INFO: 2,
DEBUG: 3,
VERBOSE: 4
},

@@ -26,7 +28,7 @@ /**

* @type {object}
* @property {int} OKAY Configured successfully.
* @property {int} FAILED_TO_INIT Configuration infomation is okay, but unable to start successfully.
* @property {int} CONFIGURATION_FILE_NOT_FOUND The provided configuration file could not be found.
* @property {int} CONFIGURATION_FILE_NOT_READABLE The provided configuration file could not be read.
* @property {int} CONFIGURATION_FILE_NOT_PARSED The provided configuration file was not valid JSON.
* @property {int} OKAY Configured successfully.
* @property {int} INVALID_PROVISION_JSON Provision information provided is invalid (likely invalid JSON).
* @property {int} MISSING_NEA_NAME Provision information does not include neaName.
* @property {int} FAILED_TO_INIT Configuration infomation is okay, but NAPI was unable to start successfully.
* @property {int} ERROR An error occurred, likely an exception, possibly involving the parameters provided.
* @property {int} IMPOSSIBLE

@@ -37,60 +39,73 @@ * @constant

OKAY: 0,
FAILED_TO_INIT: 1,
CONFIGURATION_FILE_NOT_FOUND: 2,
CONFIGURATION_FILE_NOT_READABLE: 3,
CONFIGURATION_FILE_NOT_PARSED: 4,
INVALID_PROVISION_JSON: 1,
MISSING_NEA_NAME: 2,
FAILED_TO_INIT: 3,
ERROR: 4,
IMPOSSIBLE: 5
},
/**
* @typedef JsonPutOutcome
* @typedef PutOutcome
* @type {object}
* @property {int} OKAY Sending JSON was successful.
* @property {int} NAPI_NOT_RUNNING NAPI is not running – either jsonNapiConfigure did not complete or jsonNapiTerminate was already called.
* @property {int} OKAY Sending JSON was successful.
* @property {int} NAPI_NOT_RUNNING NAPI is not running – either napiConfigure did not complete or napiTerminate was already called.
* @property {int} UNPARSEABLE_JSON The provided string is not parseable as JSON.
* @property {int} ERROR An error occurred, likely an exception.
* @property {int} IMPOSSIBLE
* @constant
*/
JsonPutOutcome = {
PutOutcome = {
OKAY: 0,
NAPI_NOT_RUNNING: 1,
IMPOSSIBLE: 2
UNPARSEABLE_JSON: 2,
ERROR: 3,
IMPOSSIBLE: 4
},
/**
* @typedef JsonGetOutcome
* @typedef GetOutcome
* @type {object}
* @property {int} OKAY A JSON string has been returned.
* @property {int} NAPI_NOT_RUNNING NAPI is not running – either jsonNapiConfigure did not complete or jsonNapiTerminate was already called.
* @property {int} TIMED_OUT The second variant of jsonNapiGet timed out.
* @property {int} QUIT_SIGNALED The third variant of jsonNapiGet was called and quit was signaled.
* @property {int} NAPI_FINISHED jsonNapiTerminate was called.
* @property {int} OKAY A JSON string has been returned.
* @property {int} NAPI_NOT_RUNNING NAPI is not running – either napiConfigure did not complete or napiTerminate was already called.
* @property {int} BUFFER_TOO_SMALL The provided char* buffer is not long enough; the length value will contain the minimum required size.
* @property {int} NAPI_TERMINATED Napi::terminate was called. This outcome will be returned once. Afterwards, the outcome is NAPI_NOT_RUNNING.
* @property {int} ERROR An error occurred, likely an exception.
* @property {int} IMPOSSIBLE
* @constant
*/
JsonGetOutcome = {
GetOutcome = {
OKAY: 0,
NAPI_NOT_RUNNING: 1,
TIMED_OUT: 2,
QUIT_SIGNALED: 3,
NAPI_FINISHED: 4,
BUFFER_TOO_SMALL: 2,
NAPI_TERMINATED: 3,
ERROR: 4,
IMPOSSIBLE: 5
},
/**
* @typedef JsonNapiResponse
* @type {object}
* @property {string} message Contains reesponse from NAPI as stringified JSON.
* @property {JsonGetOutcome} outcome Return code of the call to jsonGetD, jsonGetSD or jsonGetTSD.
* @property {boolean} quit TRUE if jsonGetSD returned due to quit beeing triggered, FALSE otherwise.
* @constant
* @typedef TryGetOutcome
* @type {object}
* @property {int} OKAY A JSON string has been returned.
* @property {int} NOTHING There is no JSON available at the time of the call.
* @property {int} NAPI_NOT_RUNNING NAPI is not running – either napiConfigure did not complete or napiTerminate was already called.
* @property {int} BUFFER_TOO_SMALL The provided char* buffer is not long enough; the length value will contain the minimum required size.
* @property {int} NAPI_TERMINATED Napi::terminate was called. This outcome will be returned once. Afterwards, the outcome is NAPI_NOT_RUNNING.
* @property {int} ERROR An error occurred, likely an exception.
* @property {int} IMPOSSIBLE
* @constant
*/
JsonNapiResponse = new Struct({
message: 'string',
outcome: 'int',
quit: 'bool'
}),
TryGetOutcome = {
OKAY: 0,
NOTHING: 1,
NAPI_NOT_RUNNING: 2,
BUFFER_TOO_SMALL: 3,
NAPI_TERMINATED: 4,
ERROR: 5,
IMPOSSIBLE: 6
},
stringPtr = ref.refType('string'),
intPtr = ref.refType('int'),
NapiInterface = {
jsonNapiConfigureD: ['int', ['string', 'int', 'int', 'string']],
jsonNapiGetD: [JsonNapiResponse, []],
jsonNapiGetSD: [JsonNapiResponse, ['bool', 'int']],
jsonNapiGetTSD: [JsonNapiResponse, ['int', 'int']],
jsonNapiPutD: ['int', ['string']],
jsonNapiTerminateD: ['void', []]
napiConfigure: ['int', ['string', 'string', 'string', 'int', 'int', 'string']],
napiGet: ['int', [stringPtr, 'int', intPtr]],
napiTryGet: ['int', [stringPtr, 'int', intPtr]],
napiPut: ['int', ['string']],
napiTerminate: ['void', []]
};

@@ -112,24 +127,35 @@

/**
* JsonGetOutcome
* GetOutcome
*
* @static
* @return {JsonGetOutcome}
* @return {GetOutcome}
*/
static get JsonGetOutcome ()
static get GetOutcome ()
{
return JsonGetOutcome;
return GetOutcome;
}
/**
* JsonPutOutcome
* TryGetOutcome
*
* @static
* @return {JsonPutOutcome}
* @return {TryGetOutcome}
*/
static get JsonPutOutcome ()
static get TryGetOutcome ()
{
return JsonPutOutcome;
return TryGetOutcome;
}
/**
* PutOutcome
*
* @static
* @return {PutOutcome}
*/
static get PutOutcome ()
{
return PutOutcome;
}
/**
* ConfigOutcome

@@ -173,8 +199,10 @@ *

* <p>Configure and start NAPI.</p>
* <p>For most NEAs the default arguments are correct so the call would be similar to jsonNapiConfigure("root-directory-path");.
* <p>For most NEAs the default arguments are correct so the call would be similar to napiConfigure("root-directory-path");.
* The default host of "" is treated as "127.0.0.1". The default port of -1 will choose the port depending on platform (OS X or Windows) and libary (native or networked).
* The rootDirectory is a directory that must contain a file called config.json. When the NEA runs, it saves provision information into a file called provisions.json.
* The NEA will also create log files in that directory.</p>
* The value of provisions should be the same as the last saved value.
* </p>
*
* @param {string} rootDirectory Path to a directory that contains the config.json file and to which NAPI writes provisions.json and any log files.
* @param {string} neaName Name of this NEA (used when provisioning). (6 to 18 characters)
* @param {string} logDirectory Path to a directory that will contain log files.
* @param {string} [provisions = '{}'] The provision data saved by previous runs of the NEA.
* @param {int} [logLevel=LogLevel.NORMAL] The log level to use (see LogLevel).

@@ -185,67 +213,90 @@ * @param {int} [port=-1] The default port for networked Nymi Bands (on Windows) or the Nymulator.

*/
jsonNapiConfigureD (rootDirectory, logLevel, port, host)
napiConfigure (neaName, logDirectory, provisions, logLevel, port, host)
{
logLevel = logLevel || LogLevel.NORMAL;
port = port || -1;
host = host || '';
return _g(this, 'binding').jsonNapiConfigureD(rootDirectory, logLevel, port, host);
neaName = String(neaName);
logDirectory = String(logDirectory);
provisions = String(provisions) || '{}';
logLevel = ~~logLevel || LogLevel.NORMAL;
port = ~~port || -1;
host = String(host) || '';
return _g(this, 'binding').napiConfigure(neaName, logDirectory, provisions, logLevel, port, host);
}
/**
* <p>Receive a JSON message from NAPI; standard usage.</p>
* <p>jsonNapiGetD is a blocking call.
* If NAPI is not running, wait a short time and call jsonNapiGetD again. No JSON messages are lost.
* <p>Receive a JSON message from NAPI, blocks if nothing is available yet; standard usage.</p>
* <p>napiGet is a blocking call.
* If NAPI is not running, wait a short time and call napiGet again. No JSON messages are lost.
* </p>
* <b>This variant returns when:</b>
* <li>A message is available from NAPI (JsonGetOutcome.OKAY)</li>
* <li>NAPI is not running (JsonGetOutcome.NAPI_NOT_RUNNING)</li>
* <li>NAPI has finished (JsonGetOutcome.NAPI_FINISHED)</li>
* <li>A message is available from NAPI (GetOutcome.OKAY)</li>
* <li>A message from NAPI is ready, but the provided buffer is too small (GetOutcome::BUFFER_TOO_SMALL)</li>
* <li>NAPI is not running (GetOutcome.NAPI_NOT_RUNNING)</li>
* <li>NAPI has terminated (GetOutcome.NAPI_TERMINATED)</li>
*
* @return {JsonNapiResponse}
* @return {{outcome: GetOutcome, json: object}}
*/
jsonNapiGetD ()
napiGet ()
{
return _g(this, 'binding').jsonNapiGetD();
let outcome, buf, len,
json = null;
try {
buf = new Buffer(4096);
len = ref.alloc('int');
buf.type = stringPtr;
outcome = _g(this, 'binding').napiGet(buf, buf.length, len);
if (outcome === NapiBinding.GetOutcome.BUFFER_TOO_SMALL) {
outcome = _g(this, 'binding').napiGet(buf, len.deref(), len);
}
if (outcome === NapiBinding.GetOutcome.OKAY) {
json = JSON.parse(buf.readCString(0));
}
} catch (err) {
outcome = NapiBinding.GetOutcome.ERROR;
}
return {outcome: outcome, json: json};
}
/**
* <p>Receive a JSON message from NAPI; variant two.</p>
* <p>jsonNapiGetSD is a blocking call.
* If NAPI is not running, wait a short time and call jsonNapiGetSD again. No JSON messages are lost.
* <p>Receive a JSON message from NAPI if one is available, non-blocking; standard usage.</p>
* <p>napiTryGet is a non-blocking call.
* If NAPI is not running, wait a short time and call napiTryGet again. No JSON messages are lost.
* </p>
* <b>This variant returns when:</b>
* <li>A message is available from NAPI (JsonGetOutcome.OKAY)</li>
* <li>NAPI is not running (JsonGetOutcome.NAPI_NOT_RUNNING)</li>
* <li>NAPI has finished (JsonGetOutcome.NAPI_FINISHED)</li>
* <li>Quit has been signaled (JsonGetOutcome.QUIT_SIGNALED)</li>
* <li>A message is available from NAPI (TryGetOutcome.OKAY)</li>
* <li>No message is available at the time of the call. (TryGetOutcome::NOTHING)</li>
* <li>A message from NAPI is ready, but the provided buffer is too small (TryGetOutcome::BUFFER_TOO_SMALL)</li>
* <li>NAPI is not running (TryGetOutcome.NAPI_NOT_RUNNING)</li>
* <li>NAPI has terminated (TryGetOutcome.NAPI_TERMINATED)</li>
*
* @param {boolean} quit An bool that causes this function to return when it is set to true.
* @param {int} [sleep=100] Quit is checked every sleep milliseconds.
* @return {JsonNapiResponse}
* @return {{outcome: (TryGetOutcome), json: object}}
*/
jsonNapiGetSD (quit, sleep)
napiTryGet ()
{
sleep = sleep || 100;
return _g(this, 'binding').jsonNapiGetSD(quit, sleep);
}
let outcome, buf, len,
json = null;
/**
* <p>Receive a JSON message from NAPI; variant one.</p>
* <p>jsonNapiGetTSD is a blocking call.
* If NAPI is not running, wait a short time and call jsonNapiGetTSD again. No JSON messages are lost.
* </p>
* <b>This variant returns when:</b>
* <li>A message is available from NAPI (JsonGetOutcome.OKAY)</li>
* <li>NAPI is not running (JsonGetOutcome.NAPI_NOT_RUNNING)</li>
* <li>NAPI has finished (JsonGetOutcome.NAPI_FINISHED)</li>
* <li>A timeout has expired without a message or finish (JsonGetOutcome.TIMED_OUT)</li>
*
* @param {int} timeout The timeout in milliseconds.
* @param {int} [sleep=100] The timeout is implemented by waiting for sleep milliseconds until the timeout is exceeded.
* @return {JsonNapiResponse}
*/
jsonNapiGetTSD (timeout, sleep)
{
sleep = sleep || 100;
return _g(this, 'binding').jsonNapiGetTSD(timeout, sleep);
try {
buf = new Buffer(4096);
len = ref.alloc('int');
buf.type = stringPtr;
outcome = _g(this, 'binding').napiTryGet(buf, buf.length, len);
if (outcome === NapiBinding.TryGetOutcome.BUFFER_TOO_SMALL) {
outcome = _g(this, 'binding').napiTryGet(buf, len.deref(), len);
}
if (outcome === NapiBinding.TryGetOutcome.OKAY) {
json = JSON.parse(buf.readCString(0));
}
} catch (err) {
outcome = NapiBinding.TryGetOutcome.ERROR;
}
return {outcome: outcome, json: json};
}

@@ -256,11 +307,11 @@

*
* @param {string} json Stringified JSON to send to NAPI.
* @return {JsonPutOutcome}
* @param {object} json Stringified JSON to send to NAPI.
* @return {PutOutcome}
*/
jsonNapiPutD (json)
napiPut (json)
{
try {
return _g(this, 'binding').jsonNapiPutD(JSON.stringify(json));
return _g(this, 'binding').napiPut(JSON.stringify(json));
} catch (err) {
return JsonPutOutcome.IMPOSSIBLE;
return PutOutcome.IMPOSSIBLE;
}

@@ -273,10 +324,9 @@ }

* <b>Note:</b>
* Calling this function, followed by a second call to jsonNapiConfigD, may appear to work, but it will eventually break in unpredictable ways.
* A future release will support this or provide other means to achieve the same effect.
* Calling this function, followed by a second call to napiConfigD, may now work (consider it beta functionality).
*
* @return {void}
*/
jsonNapiTerminateD ()
napiTerminate ()
{
_g(this, 'binding').jsonNapiTerminateD();
_g(this, 'binding').napiTerminate();
}

@@ -283,0 +333,0 @@ }

@@ -14,3 +14,3 @@ 'use strict';

cluster.on('exit', () => {
[__dirname + '/provisions.json', __dirname + '/ncl.log', __dirname + '/json-napi.log'].forEach(file => {
[__dirname + '/../ncl.log', __dirname + '/../napi.log'].forEach(file => {
return fs.existsSync(file) && fs.unlinkSync(file);

@@ -20,4 +20,7 @@ });

} else {
if (process.argv.includes('functional')) {
return nodeunit.reporters.default.run(['tests/test_functional.js'], null, process.exit);
}
nodeunit.reporters.default.run(['tests/test_' + process.platform + '.js'], null, process.exit);
}

@@ -7,7 +7,7 @@ 'use strict';

let napi = new NapiBinding(true),
init = napi.jsonNapiConfigureD(__dirname + '/not-existent', NapiBinding.LogLevel.NORMAL, 9088, '127.0.0.1');
init = napi.napiConfigure('testnea', '#', '{', NapiBinding.LogLevel.NONE, 9088, '127.0.0.1');
napi.jsonNapiTerminateD();
napi.napiTerminate();
test.equal(init, NapiBinding.ConfigOutcome.CONFIGURATION_FILE_NOT_FOUND);
test.equal(init, NapiBinding.ConfigOutcome.INVALID_PROVISION_JSON);
test.expect(1);

@@ -19,4 +19,6 @@ test.done();

let napi = new NapiBinding(false),
init = napi.jsonNapiConfigureD(__dirname, NapiBinding.LogLevel.NORMAL, 9088, '127.0.0.1');
init = napi.napiConfigure('testest', '#', '{}', NapiBinding.LogLevel.NONE, 9088, '127.0.0.1');
napi.napiTerminate();
test.equal(init, NapiBinding.ConfigOutcome.OKAY);

@@ -29,4 +31,6 @@ test.expect(1);

let napi = new NapiBinding(false),
init = napi.jsonNapiConfigureD(__dirname, NapiBinding.LogLevel.NORMAL);
init = napi.napiConfigure('testest', '#', '{}', NapiBinding.LogLevel.NONE);
napi.napiTerminate();
test.equal(init, NapiBinding.ConfigOutcome.OKAY);

@@ -33,0 +37,0 @@ test.expect(1);

@@ -5,10 +5,9 @@ 'use strict';

exports.testNymulatorOnWin = function (test) {
let napi = new NapiBinding(true),
init = napi.jsonNapiConfigureD(__dirname + '/not-existent', NapiBinding.LogLevel.NORMAL, 9088, '127.0.0.1');
init = napi.napiConfigure('testnea', '#', '{', NapiBinding.LogLevel.NONE, 9088, '127.0.0.1');
napi.jsonNapiTerminateD();
napi.napiTerminate();
test.equal(init, NapiBinding.ConfigOutcome.CONFIGURATION_FILE_NOT_FOUND);
test.equal(init, NapiBinding.ConfigOutcome.INVALID_PROVISION_JSON);
test.expect(1);

@@ -20,7 +19,7 @@ test.done();

let napi = new NapiBinding(false),
init = napi.jsonNapiConfigureD(__dirname + '/not-existent', NapiBinding.LogLevel.NORMAL, 9088, '127.0.0.1');
init = napi.napiConfigure('tes', '#', '{}', NapiBinding.LogLevel.NONE, 9088, '127.0.0.1');
napi.jsonNapiTerminateD();
napi.napiTerminate();
test.equal(init, NapiBinding.ConfigOutcome.CONFIGURATION_FILE_NOT_FOUND);
test.equal(init, NapiBinding.ConfigOutcome.FAILED_TO_INIT);
test.expect(1);

@@ -32,5 +31,5 @@ test.done();

let napi = new NapiBinding(false),
init = napi.jsonNapiConfigureD(__dirname, NapiBinding.LogLevel.NORMAL, 9089, '127.0.0.1');
init = napi.napiConfigure('testest', '#', '{}', NapiBinding.LogLevel.NONE, 9089, '127.0.0.1');
napi.jsonNapiTerminateD();
napi.napiTerminate();

@@ -44,5 +43,5 @@ test.equal(init, NapiBinding.ConfigOutcome.OKAY);

let napi = new NapiBinding(true),
init = napi.jsonNapiConfigureD(__dirname, NapiBinding.LogLevel.NORMAL, 9089, '127.0.0.1');
init = napi.napiConfigure('testest', '#', '{}', NapiBinding.LogLevel.NONE, 9089, '127.0.0.1');
napi.jsonNapiTerminateD();
napi.napiTerminate();

@@ -49,0 +48,0 @@ test.equal(init, NapiBinding.ConfigOutcome.OKAY);

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc