Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rsocket-tck

Package Overview
Dependencies
Maintainers
4
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rsocket-tck - npm Package Compare versions

Comparing version 0.0.19 to 0.0.22

LICENSE

7

build/index.js

@@ -15,3 +15,3 @@ /** Copyright (c) Facebook, Inc. and its affiliates.

*
*
*
*/

@@ -21,4 +21,3 @@

var _RSocketTckClient = require('./RSocketTckClient');
var _RSocketTckClient2 = _interopRequireDefault(_RSocketTckClient);
var _RSocketTckClient = _interopRequireDefault(require('./RSocketTckClient'));
function _interopRequireDefault(obj) {

@@ -28,2 +27,2 @@ return obj && obj.__esModule ? obj : {default: obj};

(0, _RSocketTckClient2.default)();
(0, _RSocketTckClient.default)();
'use strict';
Object.defineProperty(exports, '__esModule', {value: true});
let run = (() => {
var _ref = _asyncToGenerator(function*(options) {
const testfilePath = _path2.default.resolve(
process.cwd(),
options.testfile
);
if (!_fs2.default.existsSync(testfilePath)) {
exports.default = main;
var _rsocketCore = require('rsocket-core');
var _rsocketTcpClient = _interopRequireDefault(require('rsocket-tcp-client'));
var _RSocketTckRequestResponseSubscriber = _interopRequireDefault(
require('./RSocketTckRequestResponseSubscriber')
);
var _RSocketTckRequestStreamSubscriber = _interopRequireDefault(
require('./RSocketTckRequestStreamSubscriber')
);
var _areEqual = _interopRequireDefault(require('fbjs/lib/areEqual'));
var _chalk = _interopRequireDefault(require('chalk'));
var _fs = _interopRequireDefault(require('fs'));
var _nullthrows = _interopRequireDefault(require('fbjs/lib/nullthrows'));
var _path = _interopRequireDefault(require('path'));
var _sprintf = _interopRequireDefault(require('fbjs/lib/sprintf'));
var _util = _interopRequireDefault(require('util'));
var _yargs = _interopRequireDefault(require('yargs'));
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
}
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
try {
var info = gen[key](arg);
var value = info.value;
} catch (error) {
reject(error);
return;
}
if (info.done) {
resolve(value);
} else {
Promise.resolve(value).then(_next, _throw);
}
}
function _asyncToGenerator(fn) {
return function () {
var self = this,
args = arguments;
return new Promise(function (resolve, reject) {
var gen = fn.apply(self, args);
function _next(value) {
asyncGeneratorStep(gen, resolve, reject, _next, _throw, 'next', value);
}
function _throw(err) {
asyncGeneratorStep(gen, resolve, reject, _next, _throw, 'throw', err);
}
_next(undefined);
});
};
}
function main() {
const argv = _yargs.default
.usage('$0 --testfile <path> --host <host> --port <port> [--verbose]')
.options({
host: {
default: '127.0.0.1',
describe: 'TCK server hostname.',
type: 'string',
},
port: {
default: 9898,
describe: 'TCK server port.',
type: 'string',
},
testfile: {
default: _path.default.join(__dirname, './clienttest.txt'),
describe: 'Path to client test file.',
type: 'string',
},
verbose: {
default: false,
describe:
'Log each action as it is performed instead of just logging success/failure.',
type: 'boolean',
},
})
.help().argv;
Promise.resolve(run(argv)).then(
() => {
process.stdout.write(_chalk.default.green('All tests pass.') + '\n');
process.exit(0);
},
(error) => {
process.stderr.write(
_chalk.default.red('Test failed: ' + error.message) + '\n'
);
process.exit(1);
}
);
}
function run(_x) {
return _run.apply(this, arguments);
}
function _run() {
_run = _asyncToGenerator(function* (options) {
const testfilePath = _path.default.resolve(process.cwd(), options.testfile);
if (!_fs.default.existsSync(testfilePath)) {
throw new Error(

@@ -14,8 +111,8 @@ `--testfile ${options.testfile}: file does does not exist (${testfilePath}).`

}
process.stdout.write(_chalk2.default.inverse('Running TCK tests') + '\n');
process.stdout.write(_chalk.default.inverse('Running TCK tests') + '\n');
process.stdout.write(
(0, _sprintf2.default)('Using testfile %s', testfilePath) + '\n'
(0, _sprintf.default)('Using testfile %s', testfilePath) + '\n'
);
process.stdout.write(
(0, _sprintf2.default)(
(0, _sprintf.default)(
'Connecting to server at %s:%s',

@@ -27,6 +124,6 @@ options.host,

const testSource = _fs2.default.readFileSync(testfilePath, 'utf8');
const testCases = testSource.split('!').filter(function(item) {
return item.trim().length > 0;
});
const testSource = _fs.default.readFileSync(testfilePath, 'utf8');
const testCases = testSource
.split('!')
.filter((item) => item.trim().length > 0);

@@ -37,3 +134,3 @@ const socket = yield connect(options);

if (!cond) {
throw new Error((0, _sprintf2.default)(msg, ...rest));
throw new Error((0, _sprintf.default)(msg, ...rest));
}

@@ -44,3 +141,3 @@ }

process.stdout.write(
_chalk2.default.dim((0, _sprintf2.default)(msg, ...rest)) + '\n'
_chalk.default.dim((0, _sprintf.default)(msg, ...rest)) + '\n'
);

@@ -73,3 +170,3 @@ }

if (type === 'rr') {
subscriber = new _RSocketTckRequestResponseSubscriber2.default(
subscriber = new _RSocketTckRequestResponseSubscriber.default(
log

@@ -79,3 +176,3 @@ );

} else if (type === 'rs') {
subscriber = new _RSocketTckRequestStreamSubscriber2.default(
subscriber = new _RSocketTckRequestStreamSubscriber.default(
log

@@ -91,7 +188,7 @@ );

const [n] = args;
(0, _nullthrows2.default)(subscriber).request(parseInt(n, 10));
(0, _nullthrows.default)(subscriber).request(parseInt(n, 10));
break;
}
case 'cancel': {
(0, _nullthrows2.default)(subscriber).cancel();
(0, _nullthrows.default)(subscriber).cancel();
break;

@@ -102,5 +199,5 @@ }

if (type === 'terminal') {
yield (0, _nullthrows2.default)(subscriber).awaitTerminal();
yield (0, _nullthrows.default)(subscriber).awaitTerminal();
} else if (type === 'atLeast') {
yield (0, _nullthrows2.default)(subscriber).awaitN(
yield (0, _nullthrows.default)(subscriber).awaitN(
parseInt(nOrTime, 10)

@@ -117,6 +214,6 @@ );

const [n] = args;
yield (0, _nullthrows2.default)(subscriber).awaitN(
yield (0, _nullthrows.default)(subscriber).awaitN(
parseInt(n, 10)
);
(0, _nullthrows2.default)(subscriber).cancel();
(0, _nullthrows.default)(subscriber).cancel();
break;

@@ -128,3 +225,3 @@ }

assert(
!(0, _nullthrows2.default)(subscriber).hasError(),
!(0, _nullthrows.default)(subscriber).hasError(),
'Expected onError not to be called.'

@@ -134,3 +231,3 @@ );

assert(
(0, _nullthrows2.default)(subscriber).hasError(),
(0, _nullthrows.default)(subscriber).hasError(),
'Expected onError to be called.'

@@ -140,8 +237,8 @@ );

const expected = parsePayloads(other);
const actual = (0, _nullthrows2.default)(
const actual = (0, _nullthrows.default)(
subscriber
).getPayloads();
if (!(0, _areEqual2.default)(actual, expected)) {
log('expected: %s', _util2.default.inspect(expected));
log('actual: %s', _util2.default.inspect(actual));
if (!(0, _areEqual.default)(actual, expected)) {
log('expected: %s', _util.default.inspect(expected));
log('actual: %s', _util.default.inspect(actual));
assert(false, 'Actual/expected payloads differed.');

@@ -151,3 +248,3 @@ }

const expected = parseInt(other, 10);
const actual = (0, _nullthrows2.default)(
const actual = (0, _nullthrows.default)(
subscriber

@@ -163,3 +260,3 @@ ).getPayloads().length;

const expected = parseInt(other, 10);
const actual = (0, _nullthrows2.default)(
const actual = (0, _nullthrows.default)(
subscriber

@@ -175,3 +272,3 @@ ).getPayloads().length;

assert(
(0, _nullthrows2.default)(subscriber).isCompleted(),
(0, _nullthrows.default)(subscriber).isCompleted(),
'Expected onComplete to be called.'

@@ -181,3 +278,3 @@ );

assert(
!(0, _nullthrows2.default)(subscriber).isCompleted(),
!(0, _nullthrows.default)(subscriber).isCompleted(),
'Expected onComplete not to be called.'

@@ -187,3 +284,3 @@ );

assert(
(0, _nullthrows2.default)(subscriber).isCanceled(),
(0, _nullthrows.default)(subscriber).isCanceled(),
'Expected request to be canceled.'

@@ -206,8 +303,9 @@ );

});
return function run(_x) {
return _ref.apply(this, arguments);
};
})();
let connect = (() => {
var _ref2 = _asyncToGenerator(function*(options) {
return _run.apply(this, arguments);
}
function connect(_x2) {
return _connect.apply(this, arguments);
}
function _connect() {
_connect = _asyncToGenerator(function* (options) {
const client = new _rsocketCore.RSocketClient({

@@ -221,3 +319,3 @@ setup: {

transport: new _rsocketTcpClient2.default({
transport: new _rsocketTcpClient.default({
host: options.host,

@@ -228,3 +326,3 @@ port: options.port,

return new Promise(function(resolve, reject) {
return new Promise((resolve, reject) => {
client.connect().subscribe({

@@ -236,129 +334,8 @@ onComplete: resolve,

});
return function connect(_x2) {
return _ref2.apply(this, arguments);
};
})();
let delay = (() => {
var _ref3 = _asyncToGenerator(function*(ms) {
return new Promise(function(resolve) {
setTimeout(resolve, ms);
});
});
return function delay(_x3) {
return _ref3.apply(this, arguments);
};
})();
exports.default = main;
var _rsocketCore = require('rsocket-core');
var _rsocketTcpClient = require('rsocket-tcp-client');
var _rsocketTcpClient2 = _interopRequireDefault(_rsocketTcpClient);
var _RSocketTckRequestResponseSubscriber = require('./RSocketTckRequestResponseSubscriber');
var _RSocketTckRequestResponseSubscriber2 = _interopRequireDefault(
_RSocketTckRequestResponseSubscriber
);
var _RSocketTckRequestStreamSubscriber = require('./RSocketTckRequestStreamSubscriber');
var _RSocketTckRequestStreamSubscriber2 = _interopRequireDefault(
_RSocketTckRequestStreamSubscriber
);
var _areEqual = require('fbjs/lib/areEqual');
var _areEqual2 = _interopRequireDefault(_areEqual);
var _chalk = require('chalk');
var _chalk2 = _interopRequireDefault(_chalk);
var _fs = require('fs');
var _fs2 = _interopRequireDefault(_fs);
var _nullthrows = require('fbjs/lib/nullthrows');
var _nullthrows2 = _interopRequireDefault(_nullthrows);
var _path = require('path');
var _path2 = _interopRequireDefault(_path);
var _sprintf = require('fbjs/lib/sprintf');
var _sprintf2 = _interopRequireDefault(_sprintf);
var _util = require('util');
var _util2 = _interopRequireDefault(_util);
var _yargs = require('yargs');
var _yargs2 = _interopRequireDefault(_yargs);
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
return _connect.apply(this, arguments);
}
function _asyncToGenerator(fn) {
return function() {
var gen = fn.apply(this, arguments);
return new Promise(function(resolve, reject) {
function step(key, arg) {
try {
var info = gen[key](arg);
var value = info.value;
} catch (error) {
reject(error);
return;
}
if (info.done) {
resolve(value);
} else {
return Promise.resolve(value).then(
function(value) {
step('next', value);
},
function(err) {
step('throw', err);
}
);
}
}
return step('next');
});
};
}
/** Copyright (c) Facebook, Inc. and its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
*/ function main() {
const argv = _yargs2.default
.usage('$0 --testfile <path> --host <host> --port <port> [--verbose]')
.options({
host: {
default: '127.0.0.1',
describe: 'TCK server hostname.',
type: 'string',
},
port: {default: 9898, describe: 'TCK server port.', type: 'string'},
testfile: {
default: _path2.default.join(__dirname, './clienttest.txt'),
describe: 'Path to client test file.',
type: 'string',
},
verbose: {
default: false,
describe: 'Log each action as it is performed instead of just logging success/failure.',
type: 'boolean',
},
})
.help().argv;
Promise.resolve(run(argv)).then(
() => {
process.stdout.write(_chalk2.default.green('All tests pass.') + '\n');
process.exit(0);
},
error => {
process.stderr.write(
_chalk2.default.red('Test failed: ' + error.message) + '\n'
);
process.exit(1);
}
);
}
function parsePayloads(data) {
const payloads = [];
data.split('&&').forEach(item => {
data.split('&&').forEach((item) => {
const [data, metadata] = item.split(',');

@@ -371,1 +348,12 @@ if (data != null && metadata != null) {

}
function delay(_x3) {
return _delay.apply(this, arguments);
}
function _delay() {
_delay = _asyncToGenerator(function* (ms) {
return new Promise((resolve) => {
setTimeout(resolve, ms);
});
});
return _delay.apply(this, arguments);
}
'use strict';
Object.defineProperty(exports, '__esModule', {value: true});
exports.default = void 0;
var _Deferred = require('fbjs/lib/Deferred');
var _Deferred2 = _interopRequireDefault(_Deferred);
var _Deferred = _interopRequireDefault(require('fbjs/lib/Deferred'));
var _nullthrows = require('fbjs/lib/nullthrows');
var _nullthrows2 = _interopRequireDefault(_nullthrows);
var _nullthrows = _interopRequireDefault(require('fbjs/lib/nullthrows'));
function _interopRequireDefault(obj) {

@@ -13,22 +12,22 @@ return obj && obj.__esModule ? obj : {default: obj};

/** Copyright (c) Facebook, Inc. and its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
*/ class RSocketTckRequestResponseSubscriber {
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
*/ class RSocketTckRequestResponseSubscriber {
constructor(log) {
this._cancelled = false;
this._completeDefer = new _Deferred2.default();
this._completeDefer = new _Deferred.default();
this._completed = false;
this._errorDefer = new _Deferred2.default();
this._errorDefer = new _Deferred.default();
this._errored = false;

@@ -44,3 +43,3 @@ this._log = log;

this._payloadCount = n;
this._payloadDefer = new _Deferred2.default();
this._payloadDefer = new _Deferred.default();
return this._payloadDefer.getPromise();

@@ -78,3 +77,3 @@ }

this._cancelled = true;
(0, _nullthrows2.default)(this._subscription).cancel();
(0, _nullthrows.default)(this._subscription).cancel();
}

@@ -81,0 +80,0 @@

'use strict';
Object.defineProperty(exports, '__esModule', {value: true});
exports.default = void 0;
var _Deferred = require('fbjs/lib/Deferred');
var _Deferred2 = _interopRequireDefault(_Deferred);
var _Deferred = _interopRequireDefault(require('fbjs/lib/Deferred'));
var _nullthrows = require('fbjs/lib/nullthrows');
var _nullthrows2 = _interopRequireDefault(_nullthrows);
var _nullthrows = _interopRequireDefault(require('fbjs/lib/nullthrows'));
function _interopRequireDefault(obj) {

@@ -13,22 +12,22 @@ return obj && obj.__esModule ? obj : {default: obj};

/** Copyright (c) Facebook, Inc. and its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
*/ class RSocketTckRequestStreamSubscriber {
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
*/ class RSocketTckRequestStreamSubscriber {
constructor(log) {
this._cancelled = false;
this._completeDefer = new _Deferred2.default();
this._completeDefer = new _Deferred.default();
this._completed = false;
this._errorDefer = new _Deferred2.default();
this._errorDefer = new _Deferred.default();
this._errored = false;

@@ -44,3 +43,3 @@ this._log = log;

this._payloadCount = n;
this._payloadDefer = new _Deferred2.default();
this._payloadDefer = new _Deferred.default();
return this._payloadDefer.getPromise();

@@ -78,7 +77,7 @@ }

this._cancelled = true;
(0, _nullthrows2.default)(this._subscription).cancel();
(0, _nullthrows.default)(this._subscription).cancel();
}
request(n) {
(0, _nullthrows2.default)(this._subscription).request(n);
(0, _nullthrows.default)(this._subscription).request(n);
}

@@ -85,0 +84,0 @@

{
"name": "rsocket-tck",
"description": "RSocket TCK test utilities",
"version": "0.0.19",
"version": "0.0.22",
"repository": {

@@ -12,7 +12,8 @@ "type": "git",

"dependencies": {
"fbjs": "^1.0.0",
"rsocket-core": "^0.0.19",
"rsocket-flowable": "^0.0.14",
"rsocket-tcp-client": "^0.0.19"
}
"fbjs": "^2.0.0",
"rsocket-core": "^0.0.22",
"rsocket-flowable": "^0.0.22",
"rsocket-tcp-client": "^0.0.22"
},
"gitHead": "08bef0b23b481c3dceceef875196d8a8bfc1930c"
}

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