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

[Lens Person] Fix typos and immutability tests #2509

Merged
merged 2 commits into from
Jul 24, 2024
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion exercises/practice/lens-person/lens-person.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// This is only a SKELETON file for the 'Lense Person' exercise. It's been provided as a
// This is only a SKELETON file for the 'Lens Person' exercise. It's been provided as a
// convenience to get you started writing code faster.
//

Expand Down
30 changes: 5 additions & 25 deletions exercises/practice/lens-person/lens-person.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { bornAtLens, nameLens, streetLens } from './lens-person';

// test data
const person = new Person(
new Name('Saravanan', 'Lakshamanan'),
new Name('Saravanan', 'Lakshmanan'),
new Born(
new Address(100, 'Hospital street', 'Tamil Nadu', 'India'),
new Date(),
Expand All @@ -32,9 +32,7 @@ describe('nameLens', () => {
});

xtest('should ensure immutability by checking the original person object', () => {
expect(person).not.toStrictEqual(
new Person(new Name('Sara', 'Lakshamanan'), person.born, person.address),
);
expect(person.name).toStrictEqual(new Name('Saravanan', 'Lakshmanan'));
FriendlyUser1 marked this conversation as resolved.
Show resolved Hide resolved
});
});

Expand All @@ -53,15 +51,8 @@ describe('bornAtLens', () => {
});

xtest('should ensure immutability by checking the original person object', () => {
expect(person).not.toEqual(
new Person(
person.name,
new Born(
new Address(2, 'Exercism street', 'Tamil Nadu', 'India'),
person.born.bornOn,
),
person.address,
),
expect(person.born.bornAt).toStrictEqual(
new Address(100, 'Hospital street', 'Tamil Nadu', 'India'),
);
});
FriendlyUser1 marked this conversation as resolved.
Show resolved Hide resolved
});
Expand All @@ -78,17 +69,6 @@ describe('streetLens', () => {
});

xtest('should ensure immutability by checking the original person object', () => {
expect(person).not.toEqual(
new Person(
person.name,
person.born,
new Address(
person.address.houseNumber,
'Exercism Street',
person.address.place,
person.address.country,
),
),
);
expect(person.address.street).toStrictEqual('Coder street');
});
});