Skip to content

Commit 7146b0d

Browse files
committed
feat/ improve wording
1 parent ac605aa commit 7146b0d

File tree

1 file changed

+18
-13
lines changed

1 file changed

+18
-13
lines changed

14_contains/solution/contains-solution.spec.js

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ const contains = require('./contains-solution');
33
describe('contains', () => {
44
const object = {
55
data: {
6-
banana: NaN,
6+
duplicate: 'e',
77
info: {
8+
duplicate: 'e',
89
magicNumber: 44,
910
stuff: {
1011
thing: {
@@ -19,27 +20,31 @@ describe('contains', () => {
1920
}
2021
}
2122

22-
test('true if property is number', () => {
23-
expect(contains(nestedObject, 44)).toBe(true);
23+
test('true if the provided number is a value within the object', () => {
24+
expect(contains(object, 44)).toBe(true);
2425
});
2526

26-
test('true if property is string', () => {
27-
expect(contains(nestedObject, 'foo')).toBe(true);
27+
test('true if the provided string is a value within the object', () => {
28+
expect(contains(object, 'foo')).toBe(true);
2829
});
2930

30-
test('does not do type conversions', () => {
31-
expect(contains(nestedObject, '44')).toBe(false);
31+
test('does not convert input string into a number when searching for a value within the object', () => {
32+
expect(contains(object, '44')).toBe(false);
3233
});
3334

34-
test('false if property is not in object', () => {
35-
expect(contains(nestedObject, 'bar')).toBe(false);
35+
test('false if the provided string is not a value within the object', () => {
36+
expect(contains(object, 'bar')).toBe(false);
3637
});
3738

38-
test('true if property is duplicated', () => {
39-
expect(contains(nestedObject, NaN)).toBe(true);
39+
test('true if the provided string is duplicated', () => {
40+
expect(contains(object, 'e')).toBe(true);
4041
});
4142

42-
test('false if property exists but is not primitive', () => {
43-
expect(contains(nestedObject, [42])).toBe(false);
43+
test('false if the provided property exists but is not a primitive', () => {
44+
expect(contains(object, [42])).toBe(false);
45+
});
46+
47+
test('true if NaN is a property within the object', () => {
48+
expect(contains(object, NaN)).toBe(true);
4449
});
4550
});

0 commit comments

Comments
 (0)