in javascript using the Jasmine NPM module, how would one code these tests. Command tests Test 1
Question:
in javascript using the Jasmine NPM module, how would one code these tests.
Command tests
Test 1
Create a secondCommandtest using, "constructor sets command type" as the description. This test checks that theconstructorin theCommandclass correctly sets thecommandTypeproperty in the new object.
- Without editing,command.jscontains the correct code. Click "Run" to verify that the first and second tests both pass.
- You do not need to useassert.throws()in this test.
- You may not need to know the specific types of commands to write this test.
Test 2
Code a third test using, "constructor sets a value passed in as the 2nd argument" as the description. This test checks that theconstructorcorrectly sets thevalueproperty in the new object.
- You may not need to know a propervaluein order to write this test.
Message tests
Test 1
For this test description, use the text, "throws error if a name is NOT passed into the constructor as the first parameter".
Test 2
Use "constructor sets name" as the description. The test confirms that theconstructorin theMessageclass correctly sets thenameproperty in a new message object.
Test 3
Use "contains a commands array passed into the constructor as 2nd argument". This test confirms that thecommandsproperty of a new message object contains the data passed in from theMessage(name,commands)call.
- Hint: Inside this test, you will have to create acommandsarray, fill it with someCommandobjects, and pass it into theMessageconstructor.
Rover tests
Test 1
"constructor sets position and default values for mode and generatorWatts". Refer to theRover Classdescription above for these default values.
Test 2
"response returned by receiveMessage contains name of message"
Test 3
"response returned by receiveMessage includes two results if two commands are sent in the message"
Test 4
"responds correctly to status check command"
- For theSTATUS_CHECKcommand,receiveMessage(message).resultsincludes aroverStatusobject describing the current state of the rover object ---mode,generatorWatts, andposition. The test should check each of these for accuracy.
- See theRover Command Typestable for more details.
Test 5
"responds correctly to mode change command".
- The test should check thecompletedproperty and rover mode for accuracy.
- The rover has two modes that can be passed a values to a mode change command, 'LOW_POWER' and 'NORMAL'.
Test 6
"responds with false completed value when attempting to move in LOW_POWER mode".
- The test should check thecompletedproperty for accuracy and confirm that the rover position did not change.
- Use theRover Modes tablefor guidance on how to handle move commands in different modes.
Test 7
"responds with position for move command".
- AMOVEcommand will update the rover's position with the position value in the command.
Applied Regression Analysis and Other Multivariable Methods
ISBN: 978-1285051086
5th edition
Authors: David G. Kleinbaum, Lawrence L. Kupper, Azhar Nizam, Eli S. Rosenberg