fix(challenge): rename challenge, change fields to properties, fix test (#36338)
* fix(challenge): rename challenge, change fields to properties, fix test * fix(challenge): update challenge name in meta.json * fix(challenge): update test and assertion message * fix(challenge): update second assert message * fix(challenge): remove the word Person from text
This commit is contained in:
		
				
					committed by
					
						 Oliver Eyton-Williams
						Oliver Eyton-Williams
					
				
			
			
				
	
			
			
			
						parent
						
							a658af6d18
						
					
				
				
					commit
					f03f05d53d
				
			| @@ -78,7 +78,7 @@ | |||||||
|     ], |     ], | ||||||
|     [ |     [ | ||||||
|       "587d7b8a367417b2b2512b4f", |       "587d7b8a367417b2b2512b4f", | ||||||
|       "Write Concise Object Literal Declarations Using Simple Fields" |       "Write Concise Object Literal Declarations Using Object Property Shorthand" | ||||||
|     ], |     ], | ||||||
|     [ |     [ | ||||||
|       "587d7b8b367417b2b2512b50", |       "587d7b8b367417b2b2512b50", | ||||||
|   | |||||||
| @@ -1,6 +1,6 @@ | |||||||
| --- | --- | ||||||
| id: 587d7b8a367417b2b2512b4f | id: 587d7b8a367417b2b2512b4f | ||||||
| title: Write Concise Object Literal Declarations Using Simple Fields | title: Write Concise Object Literal Declarations Using Object Property Shorthand | ||||||
| challengeType: 1 | challengeType: 1 | ||||||
| --- | --- | ||||||
| 
 | 
 | ||||||
| @@ -16,7 +16,7 @@ const getMousePosition = (x, y) => ({ | |||||||
| }); | }); | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| <code>getMousePosition</code> is a simple function that returns an object containing two fields. | <code>getMousePosition</code> is a simple function that returns an object containing two properties. | ||||||
| ES6 provides the syntactic sugar to eliminate the redundancy of having to write <code>x: x</code>. You can simply write <code>x</code> once, and it will be converted to<code>x: x</code> (or something equivalent) under the hood. | ES6 provides the syntactic sugar to eliminate the redundancy of having to write <code>x: x</code>. You can simply write <code>x</code> once, and it will be converted to<code>x: x</code> (or something equivalent) under the hood. | ||||||
| Here is the same function from above rewritten to use this new syntax: | Here is the same function from above rewritten to use this new syntax: | ||||||
| 
 | 
 | ||||||
| @@ -28,7 +28,7 @@ const getMousePosition = (x, y) => ({ x, y }); | |||||||
| 
 | 
 | ||||||
| ## Instructions | ## Instructions | ||||||
| <section id='instructions'> | <section id='instructions'> | ||||||
| Use simple fields with object literals to create and return a <code>Person</code> object with <code>name</code>, <code>age</code> and <code>gender</code> properties. | Use object property shorthand with object literals to create and return an object with <code>name</code>, <code>age</code> and <code>gender</code> properties. | ||||||
| </section> | </section> | ||||||
| 
 | 
 | ||||||
| ## Tests | ## Tests | ||||||
| @@ -36,10 +36,10 @@ Use simple fields with object literals to create and return a <code>Person</code | |||||||
| 
 | 
 | ||||||
| ```yml | ```yml | ||||||
| tests: | tests: | ||||||
|   - text: 'The output is <code>{name: "Zodiac Hasbro", age: 56, gender: "male"}</code>.' |   - text: '<code>createPerson("Zodiac Hasbro", 56, "male")</code> should return <code>{name: "Zodiac Hasbro", age: 56, gender: "male"}</code>.' | ||||||
|     testString: 'assert((() => {const res={name:"Zodiac Hasbro",age:56,gender:"male"}; const person=createPerson("Zodiac Hasbro", 56, "male"); return Object.keys(person).every(k => person[k] === res[k]);})(), ''The output is <code>{name: "Zodiac Hasbro", age: 56, gender: "male"}</code>.'');' |     testString: assert.deepEqual({name:"Zodiac Hasbro",age:56,gender:"male"}, createPerson("Zodiac Hasbro", 56, "male")); | ||||||
|   - text: No <code>key:value</code> were used. |   - text: Your code should not use <code>key:value</code>. | ||||||
|     testString: getUserInput => assert(!getUserInput('index').match(/:/g), 'No <code>key:value</code> were used.'); |     testString: getUserInput => assert(!getUserInput('index').match(/:/g)); | ||||||
| 
 | 
 | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
		Reference in New Issue
	
	Block a user