Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit ca791b3

Browse files
ankomattphillips
authored andcommitted
Add failing tests for #58
#58 "Comparing object with "hasOwnProperty" keys fails"
1 parent ff1235e commit ca791b3

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

‎src/added/index.test.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,5 +105,13 @@ describe('.addedDiff', () => {
105105
expect(addedDiff(lhs, rhs)).toEqual({ date: new Date('2016') });
106106
});
107107
});
108+
109+
describe('object with non-function hasOwnProperty property', () => {
110+
test('can represent the property in diff despite it being part of Object.prototype', () => {
111+
const lhs = {};
112+
const rhs = { hasOwnProperty: true };
113+
expect(addedDiff(lhs, rhs)).toEqual({ hasOwnProperty: true });
114+
});
115+
});
108116
});
109117
});

‎src/deleted/index.test.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,5 +107,13 @@ describe('.deletedDiff', () => {
107107
expect(deletedDiff({ date: new Date('2016') }, rhs)).toEqual({ date: undefined });
108108
});
109109
});
110+
111+
describe('object with non-function hasOwnProperty property', () => {
112+
test('can represent the property in diff despite it being part of Object.prototype', () => {
113+
const lhs = { hasOwnProperty: true };
114+
const rhs = {};
115+
expect(deletedDiff(lhs, rhs)).toEqual({ hasOwnProperty: undefined });
116+
});
117+
});
110118
});
111119
});

‎src/updated/index.test.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,5 +147,13 @@ describe('.updatedDiff', () => {
147147
expect(updatedDiff(lhs, rhs)).toEqual({ date: new Date('2017') });
148148
});
149149
});
150+
151+
describe('object with non-function hasOwnProperty property', () => {
152+
test('can represent the property in diff despite it being part of Object.prototype', () => {
153+
const lhs = { hasOwnProperty: false };
154+
const rhs = { hasOwnProperty: true };
155+
expect(updatedDiff(lhs, rhs)).toEqual({ hasOwnProperty: true });
156+
});
157+
});
150158
});
151159
});

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /