From 9a2d38acffc3d7fe6d25852c4d83eb0b60bcd59b Mon Sep 17 00:00:00 2001 From: jdalton Date: Tue, 7 Apr 2015 00:24:22 -0700 Subject: [PATCH] Cleanup `_.method` tests. --- test/test.js | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/test/test.js b/test/test.js index 7cd45c3fa..044fa5fe0 100644 --- a/test/test.js +++ b/test/test.js @@ -10340,21 +10340,21 @@ QUnit.module('lodash.method'); (function() { - test('should create a function that calls a property function of a given object', 3, function() { - var object = { 'a': _.constant(1), 'b': _.constant(2) }, - method = _.method('a'); + test('should create a function that calls a method of a given object', 4, function() { + var object = { 'a': _.constant(1) }; - strictEqual(method.length, 1); - strictEqual(method(object), 1); - - method = _.method('b'); - strictEqual(method(object), 2); + _.each(['a', ['a']], function(path) { + var method = _.method(path); + strictEqual(method.length, 1); + strictEqual(method(object), 1); + }); }); - test('should work with non-string `prop` arguments', 1, function() { + test('should work with non-string `path` arguments', 1, function() { var array = _.times(3, _.constant), - prop = _.method(1); - strictEqual(prop(array), 1); + method = _.method(1); + + strictEqual(method(array), 1); }); test('should coerce key to a string', 1, function() { @@ -10377,11 +10377,11 @@ }); test('should pluck inherited property values', 1, function() { - function Foo() { this.a = 1; } - Foo.prototype.b = _.constant(2); + function Foo() {} + Foo.prototype.a = _.constant(1); - var method = _.method('b'); - strictEqual(method(new Foo), 2); + var method = _.method('a'); + strictEqual(method(new Foo), 1); }); test('should work when `object` is nullish', 1, function() {