-
Notifications
You must be signed in to change notification settings - Fork 0
/
carExpert
executable file
·37 lines (29 loc) · 1.24 KB
/
carExpert
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
37
#!/usr/bin/env node
const BinaryResponse = require('./src/binaryResponse');
const userInput = require('./src/userInput');
const fuelInjectionQuestion = new BinaryResponse(
userInput('Does your car have fuel injection?'),
() => 'Get it in for service.',
() => 'Check to ensure the choke is opening and closing.');
const engineStallQuestion = new BinaryResponse(
userInput('Does the engine start and then die?'),
() => fuelInjectionQuestion.collect(),
() => 'Stop wastin\' my time!');
const engineCrankQuestion = new BinaryResponse(
userInput('Does the car crank up but fail to start?'),
() => 'Check spark plug connections.',
() => engineStallQuestion.collect());
const clickingQuestion = new BinaryResponse(
userInput('Does the car make a clicking noise?'),
() => 'Replace the battery.',
() => engineCrankQuestion.collect());
const batteryQuestion = new BinaryResponse(
userInput('Are the battery terminals corroded?'),
() => 'Clean terminals and try starting again.',
() => 'Replace cables and try again');
const silentQuestion = new BinaryResponse(
userInput('Is the car silent when you turn the key?'),
() => batteryQuestion.collect(),
() => clickingQuestion.collect());
silentQuestion.collect()
.then(console.log);