Socket
Socket
Sign inDemoInstall

@nestia/e2e

Package Overview
Dependencies
Maintainers
1
Versions
54
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nestia/e2e - npm Package Compare versions

Comparing version 0.3.2 to 0.3.3

0

lib/ArrayUtil.d.ts

@@ -0,0 +0,0 @@ /**

2

lib/ArrayUtil.js

@@ -226,3 +226,3 @@ "use strict";

};
})(ArrayUtil = exports.ArrayUtil || (exports.ArrayUtil = {}));
})(ArrayUtil || (exports.ArrayUtil = ArrayUtil = {}));
//# sourceMappingURL=ArrayUtil.js.map

@@ -0,0 +0,0 @@ /**

@@ -194,3 +194,2 @@ "use strict";

return __generator(this, function (_b) {
var _c;
switch (_b.label) {

@@ -221,3 +220,3 @@ case 0: return [4 /*yield*/, fs_1.default.promises.readdir(path)];

_b.label = 7;
case 7: return [4 /*yield*/, (_c = location_1, Promise.resolve().then(function () { return __importStar(require(_c)); }))];
case 7: return [4 /*yield*/, Promise.resolve("".concat(location_1)).then(function (s) { return __importStar(require(s)); })];
case 8:

@@ -358,3 +357,3 @@ modulo = _b.sent();

};
})(DynamicExecutor = exports.DynamicExecutor || (exports.DynamicExecutor = {}));
})(DynamicExecutor || (exports.DynamicExecutor = DynamicExecutor = {}));
//# sourceMappingURL=DynamicExecutor.js.map

@@ -0,0 +0,0 @@ /**

@@ -67,3 +67,3 @@ "use strict";

}
})(GaffComparator = exports.GaffComparator || (exports.GaffComparator = {}));
})(GaffComparator || (exports.GaffComparator = GaffComparator = {}));
//# sourceMappingURL=GaffComparator.js.map
import * as e2e from "./module";
export default e2e;
export * from "./module";

@@ -0,0 +0,0 @@ "use strict";

@@ -1,1 +0,1 @@

export declare function json_equal_to<T>(x: T, y: T): string[];
export declare const json_equal_to: (exception: (key: string) => boolean) => <T>(x: T) => (y: T) => string[];
"use strict";
var __read = (this && this.__read) || function (o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.json_equal_to = void 0;
function array_equal_to(items, name, x, y) {
if (x.length !== y.length)
items.push("".concat(name, ".length"));
x.forEach(function (xItem, i) { return any_equal_to(items, "".concat(name, "[").concat(i, "]"), xItem, y[i]); });
}
function object_equal_to(items, name, x, y) {
for (var key in x) {
if (key.substr(-2) === "id" || key.substr(-3) === "_at")
continue;
any_equal_to(items, "".concat(name, ".").concat(key), x[key], y[key]);
}
return true;
}
function any_equal_to(items, name, x, y) {
if (typeof x !== typeof y)
items.push(name);
else if (x instanceof Array)
if (!(y instanceof Array))
items.push(name);
else
array_equal_to(items, name, x, y);
else if (x instanceof Object)
object_equal_to(items, name, x, y);
else if (x !== y)
items.push(name);
}
function json_equal_to(x, y) {
var ret = [];
any_equal_to(ret, "", x, y);
return ret;
}
var json_equal_to = function (exception) {
return function (x) {
return function (y) {
var container = [];
var iterate = function (accessor) {
return function (x) {
return function (y) {
if (typeof x !== typeof y)
container.push(accessor);
else if (x instanceof Array)
if (!(y instanceof Array))
container.push(accessor);
else
array(accessor)(x)(y);
else if (x instanceof Object)
object(accessor)(x)(y);
else if (x !== y)
container.push(accessor);
};
};
};
var array = function (accessor) {
return function (x) {
return function (y) {
if (x.length !== y.length)
container.push("".concat(accessor, ".length"));
x.forEach(function (xItem, i) {
return iterate("".concat(accessor, "[").concat(i, "]"))(xItem)(y[i]);
});
};
};
};
var object = function (accessor) {
return function (x) {
return function (y) {
return Object.entries(x)
.filter(function (_a) {
var _b = __read(_a, 1), k = _b[0];
return !exception(k);
})
.forEach(function (_a) {
var _b = __read(_a, 2), k = _b[0], v = _b[1];
return iterate("".concat(accessor, ".").concat(k))(v)(y[k]);
});
};
};
};
iterate("")(x)(y);
return container;
};
};
};
exports.json_equal_to = json_equal_to;
//# sourceMappingURL=json_equal_to.js.map

@@ -0,0 +0,0 @@ export * from "./ArrayUtil";

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ /**

@@ -173,3 +173,3 @@ "use strict";

};
})(RandomGenerator = exports.RandomGenerator || (exports.RandomGenerator = {}));
})(RandomGenerator || (exports.RandomGenerator = RandomGenerator = {}));
//# sourceMappingURL=RandomGenerator.js.map

@@ -0,0 +0,0 @@ /**

@@ -88,3 +88,3 @@ "use strict";

};
})(StopWatch = exports.StopWatch || (exports.StopWatch = {}));
})(StopWatch || (exports.StopWatch = StopWatch = {}));
//# sourceMappingURL=StopWatch.js.map

@@ -25,5 +25,6 @@ /**

* @param title Title of error message when different
* @param exception Exception filter for ignoring some keys
* @returns Currying function
*/
const equals: (title: string) => <T>(x: T) => (y: T) => void;
const equals: (title: string, exception?: (key: string) => boolean) => <T>(x: T) => (y: T) => void;
/**

@@ -30,0 +31,0 @@ * Test whether error occurs.

@@ -110,8 +110,10 @@ "use strict";

* @param title Title of error message when different
* @param exception Exception filter for ignoring some keys
* @returns Currying function
*/
TestValidator.equals = function (title) {
TestValidator.equals = function (title, exception) {
if (exception === void 0) { exception = function () { return false; }; }
return function (x) {
return function (y) {
var diff = (0, json_equal_to_1.json_equal_to)(x, y);
var diff = (0, json_equal_to_1.json_equal_to)(exception)(x)(y);
if (diff.length)

@@ -372,3 +374,3 @@ throw new Error("Bug on ".concat(title, ": found different values - [").concat(diff.join(", "), "]"));

};
})(TestValidator = exports.TestValidator || (exports.TestValidator = {}));
})(TestValidator || (exports.TestValidator = TestValidator = {}));
function get_ids(entities) {

@@ -375,0 +377,0 @@ return entities.map(function (entity) { return entity.id; }).sort(function (x, y) { return (x < y ? -1 : 1); });

{
"name": "@nestia/e2e",
"version": "0.3.2",
"version": "0.3.3",
"description": "E2E test utilify functions",

@@ -41,5 +41,5 @@ "main": "lib/index.js",

"ts-node": "^10.9.1",
"ts-patch": "^2.1.0",
"typescript": "^4.9.5",
"typia": "^3.8.4"
"ts-patch": "^3.0.0",
"typescript": "^5.1.3",
"typia": "^4.0.10"
},

@@ -46,0 +46,0 @@ "dependencies": {

@@ -1,37 +0,36 @@

function array_equal_to(
items: string[],
name: string,
x: any[],
y: any[],
): void {
if (x.length !== y.length) items.push(`${name}.length`);
x.forEach((xItem, i) => any_equal_to(items, `${name}[${i}]`, xItem, y[i]));
}
export const json_equal_to =
(exception: (key: string) => boolean) =>
<T>(x: T) =>
(y: T): string[] => {
const container: string[] = [];
const iterate =
(accessor: string) =>
(x: any) =>
(y: any): void => {
if (typeof x !== typeof y) container.push(accessor);
else if (x instanceof Array)
if (!(y instanceof Array)) container.push(accessor);
else array(accessor)(x)(y);
else if (x instanceof Object) object(accessor)(x)(y);
else if (x !== y) container.push(accessor);
};
const array =
(accessor: string) =>
(x: any[]) =>
(y: any[]): void => {
if (x.length !== y.length) container.push(`${accessor}.length`);
x.forEach((xItem, i) =>
iterate(`${accessor}[${i}]`)(xItem)(y[i]),
);
};
const object =
(accessor: string) =>
(x: any) =>
(y: any): void =>
Object.entries(x)
.filter(([k]) => !exception(k))
.forEach(([k, v]) => iterate(`${accessor}.${k}`)(v)(y[k]));
function object_equal_to(
items: string[],
name: string,
x: any,
y: any,
): boolean {
for (const key in x) {
if (key.substr(-2) === "id" || key.substr(-3) === "_at") continue;
any_equal_to(items, `${name}.${key}`, x[key], y[key]);
}
return true;
}
function any_equal_to(items: string[], name: string, x: any, y: any): void {
if (typeof x !== typeof y) items.push(name);
else if (x instanceof Array)
if (!(y instanceof Array)) items.push(name);
else array_equal_to(items, name, x, y);
else if (x instanceof Object) object_equal_to(items, name, x, y);
else if (x !== y) items.push(name);
}
export function json_equal_to<T>(x: T, y: T): string[] {
const ret: string[] = [];
any_equal_to(ret, "", x, y);
return ret;
}
iterate("")(x)(y);
return container;
};

@@ -61,9 +61,10 @@ import { is_sorted } from "tstl/ranges";

* @param title Title of error message when different
* @param exception Exception filter for ignoring some keys
* @returns Currying function
*/
export const equals =
(title: string) =>
(title: string, exception: (key: string) => boolean = () => false) =>
<T>(x: T) =>
(y: T) => {
const diff: string[] = json_equal_to(x, y);
const diff: string[] = json_equal_to(exception)(x)(y);
if (diff.length)

@@ -70,0 +71,0 @@ throw new Error(

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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