How to write the class, using else if statement, for the following code that allows me to
Question:
How to write the class, using else if statement, for the following code that allows me to move 98382 to 7 using the 'MOVE' command?:
it("responds with position for move command", function() {
let commands = [
new Command('MOVE', 7),
new Command('STATUS_CHECK')
];
let message = new Message('Test message with two commands', commands);
let rover = new Rover(98382);
let response = rover.receiveMessage(message);
// "updates rovers position correctly when receiving a move command"
// console.log(response.results[1].completed)
expect(rover.position).toEqual(7)
// console.log(response.results)
expect(response.results[1].completed).toEqual(true)
Below is my inaccurate attempt at moving the code. I need to enable the 'test' to pass.
else if (command.position === 'MOVE'){
result.completed = true;
// response = rover.receiveMessage(command)
// this.position = response.messsage
this.position = position
result.rover = {mode: this.mode, LOW_POWER: this.LOW_POWER, position: this.position}
Concepts of Database Management
ISBN: 978-1285427102
8th edition
Authors: Philip J. Pratt, Mary Z. Last