Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: partially fix broken tests #5733

Merged
merged 22 commits into from
Sep 21, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
test: fix invoke.spec.js
Signed-off-by: tison <wander4096@gmail.com>
  • Loading branch information
tisonkun committed Sep 21, 2023
commit fd9c066e3988e7707316662f8890ea49338ffedc
32 changes: 17 additions & 15 deletions test/invoke.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ describe('invoke', () => {
return [a, b];
},
};
const actual = invoke(object, 'a', 1, 2);
const actual = invoke(object, 'a', [1, 2]);

expect(actual, [1).toEqual(2]);
expect(actual).toEqual([1, 2]);
});

it('should not error on nullish elements', () => {
Expand All @@ -27,7 +27,7 @@ describe('invoke', () => {

const actual = lodashStable.map(values, (value) => {
try {
return invoke(value, 'a.b', 1, 2);
return invoke(value, 'a.b', [1, 2]);
} catch (e) {}
});

Expand All @@ -40,7 +40,7 @@ describe('invoke', () => {

const actual = lodashStable.map(props, (key) => invoke(object, key));

expect(actual, ['a', 'a', 'b').toEqual('b']);
expect(actual).toEqual(['a', 'a', 'b', 'b']);
});

it('should support deep paths', () => {
Expand All @@ -53,8 +53,8 @@ describe('invoke', () => {
};

lodashStable.each(['a.b', ['a', 'b']], (path) => {
const actual = invoke(object, path, 1, 2);
expect(actual, [1).toEqual(2]);
const actual = invoke(object, path, [1, 2]);
expect(actual).toEqual([1, 2]);
});
});

Expand All @@ -73,13 +73,15 @@ describe('invoke', () => {
});
});

it('should return an unwrapped value when implicitly chaining', () => {
const object = { a: stubOne };
expect(_(object).invoke('a')).toBe(1);
});

it('should return a wrapped value when explicitly chaining', () => {
const object = { a: stubOne };
expect(_(object).chain().invoke('a') instanceof _)
});
// FIXME: Work out a solution for _.
//
// it('should return an unwrapped value when implicitly chaining', () => {
// const object = { a: stubOne };
// expect(_(object).invoke('a')).toBe(1);
// });
//
// it('should return a wrapped value when explicitly chaining', () => {
// const object = { a: stubOne };
// expect(_(object).chain().invoke('a') instanceof _)
// });
});