[Pkg-javascript-commits] [node-stack-utils] 36/67: Cleaned up wrapCallSite Test

Bastien Roucariès rouca at moszumanska.debian.org
Thu Sep 7 09:53:04 UTC 2017


This is an automated email from the git hooks/post-receive script.

rouca pushed a commit to branch master
in repository node-stack-utils.

commit dcbcd79d0ea77510a9972f9cdc8cb9bc2ac03a2c
Author: Ben McCurdy <bpmccurdy at gmail.com>
Date:   Mon Oct 24 14:17:44 2016 -0700

    Cleaned up wrapCallSite Test
---
 test/test.js | 21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)

diff --git a/test/test.js b/test/test.js
index 37af4a0..39cc5ef 100644
--- a/test/test.js
+++ b/test/test.js
@@ -237,23 +237,22 @@ test('capture: with limit and stackStart function', t => {
 });
 
 test('capture: with wrapCallSite function', t => {
-	var wrapper = function (frame) {
-		var object = {};
-		Object.getOwnPropertyNames(Object.getPrototypeOf(frame)).forEach(function (name) {
-			object[name] = /^(?:is|get)/.test(name) ? function () {
-				return frame[name];
-			} : frame[name];
-		});
-		object.getFunctionName = function () {
-			return 'testFunctionName';
+	const wrapper = function (callsite) {
+		return {
+			getMethodName: function () {
+				return callsite.getMethodName();
+			},
+			getFunctionName: function () {
+				return 'testOverrideFunctionName';
+			}
 		};
-		return object;
 	};
 	const stackUtil = new StackUtils({internals: internals(), cwd: fixtureDir, wrapCallSite: wrapper});
 	const capture = new CaptureFixture(stackUtil);
 	const stack = capture.redirect1('redirect2', 'call', 'capture', 1, capture.call);
 	t.is(stack.length, 1);
-	t.is(stack[0].getFunctionName(), 'testFunctionName');
+	t.is(stack[0].getFunctionName(), 'testOverrideFunctionName');
+	t.is(stack[0].getMethodName(), 'redirect2');
 });
 
 test('at', t => {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-stack-utils.git



More information about the Pkg-javascript-commits mailing list