forked from Team-Masark/nodebot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.js
36 lines (33 loc) · 833 Bytes
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
const Robot = require('./lib/robot')
const nodebot = Robot({
mlPositive: 22,
mlNegative: 23,
mrPositive: 24,
mrNegative: 25
})
const twoSecondTimeout = () => new Promise(resolve => setTimeout(resolve, 2000))
nodebot.moveForward()
.then(() => {
console.log('The bot should be MOVING FORWARD')
return twoSecondTimeout()
})
.then(() => nodebot.moveBackward())
.then(() => {
console.log('The bot should be MOVING BACKWARD')
return twoSecondTimeout()
})
.then(() => nodebot.moveLeft())
.then(() => {
console.log('The bot should be MOVING LEFT')
return twoSecondTimeout()
})
.then(() => nodebot.moveRight())
.then(() => {
console.log('The bot should be MOVING RIGHT')
return twoSecondTimeout()
})
.then(() => nodebot.stop())
.then(() => {
console.log('The bot should STOP')
})
.catch(console.error)