Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
144 changes: 144 additions & 0 deletions .results.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
{
"stats": {
"suites": 4,
"tests": 9,
"passes": 9,
"pending": 0,
"failures": 0,
"start": "2025-05-05T16:03:14.803Z",
"end": "2025-05-05T16:03:14.917Z",
"duration": 114
},
"tests": [
{
"title": "gives customers a free sample if the ride is less than or equal to 400 feet",
"fullTitle": "index.js scuberGreetingForFeet() gives customers a free sample if the ride is less than or equal to 400 feet",
"duration": 0,
"currentRetry": 0,
"err": {}
},
{
"title": "charges 20 dollars for a distance between 400 and 2000 feet",
"fullTitle": "index.js scuberGreetingForFeet() charges 20 dollars for a distance between 400 and 2000 feet",
"duration": 0,
"currentRetry": 0,
"err": {}
},
{
"title": "charges 30 dollars for a distance over 2000 feet",
"fullTitle": "index.js scuberGreetingForFeet() charges 30 dollars for a distance over 2000 feet",
"duration": 0,
"currentRetry": 0,
"err": {}
},
{
"title": "does not allow rides over 2500 feet",
"fullTitle": "index.js scuberGreetingForFeet() does not allow rides over 2500 feet",
"duration": 0,
"currentRetry": 0,
"err": {}
},
{
"title": "returns \"Ok, sounds good.\" when the city is NYC",
"fullTitle": "index.js ternaryCheckCity() returns \"Ok, sounds good.\" when the city is NYC",
"duration": 0,
"currentRetry": 0,
"err": {}
},
{
"title": "should return \"No go.\" if the destination city is not NYC",
"fullTitle": "index.js ternaryCheckCity() should return \"No go.\" if the destination city is not NYC",
"duration": 0,
"currentRetry": 0,
"err": {}
},
{
"title": "should return \"Thank you so much.\" if the tip is generous",
"fullTitle": "index.js switchOnCharmFromTip() should return \"Thank you so much.\" if the tip is generous",
"duration": 0,
"currentRetry": 0,
"err": {}
},
{
"title": "should return \"Thank you.\" if the tip is not as generous",
"fullTitle": "index.js switchOnCharmFromTip() should return \"Thank you.\" if the tip is not as generous",
"duration": 0,
"currentRetry": 0,
"err": {}
},
{
"title": "should return \"Bye.\" if anything else",
"fullTitle": "index.js switchOnCharmFromTip() should return \"Bye.\" if anything else",
"duration": 0,
"currentRetry": 0,
"err": {}
}
],
"pending": [],
"failures": [],
"passes": [
{
"title": "gives customers a free sample if the ride is less than or equal to 400 feet",
"fullTitle": "index.js scuberGreetingForFeet() gives customers a free sample if the ride is less than or equal to 400 feet",
"duration": 0,
"currentRetry": 0,
"err": {}
},
{
"title": "charges 20 dollars for a distance between 400 and 2000 feet",
"fullTitle": "index.js scuberGreetingForFeet() charges 20 dollars for a distance between 400 and 2000 feet",
"duration": 0,
"currentRetry": 0,
"err": {}
},
{
"title": "charges 30 dollars for a distance over 2000 feet",
"fullTitle": "index.js scuberGreetingForFeet() charges 30 dollars for a distance over 2000 feet",
"duration": 0,
"currentRetry": 0,
"err": {}
},
{
"title": "does not allow rides over 2500 feet",
"fullTitle": "index.js scuberGreetingForFeet() does not allow rides over 2500 feet",
"duration": 0,
"currentRetry": 0,
"err": {}
},
{
"title": "returns \"Ok, sounds good.\" when the city is NYC",
"fullTitle": "index.js ternaryCheckCity() returns \"Ok, sounds good.\" when the city is NYC",
"duration": 0,
"currentRetry": 0,
"err": {}
},
{
"title": "should return \"No go.\" if the destination city is not NYC",
"fullTitle": "index.js ternaryCheckCity() should return \"No go.\" if the destination city is not NYC",
"duration": 0,
"currentRetry": 0,
"err": {}
},
{
"title": "should return \"Thank you so much.\" if the tip is generous",
"fullTitle": "index.js switchOnCharmFromTip() should return \"Thank you so much.\" if the tip is generous",
"duration": 0,
"currentRetry": 0,
"err": {}
},
{
"title": "should return \"Thank you.\" if the tip is not as generous",
"fullTitle": "index.js switchOnCharmFromTip() should return \"Thank you.\" if the tip is not as generous",
"duration": 0,
"currentRetry": 0,
"err": {}
},
{
"title": "should return \"Bye.\" if anything else",
"fullTitle": "index.js switchOnCharmFromTip() should return \"Bye.\" if anything else",
"duration": 0,
"currentRetry": 0,
"err": {}
}
]
}
32 changes: 26 additions & 6 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,31 @@
function scuberGreetingForFeet(){
// Write your code here!
function scuberGreetingForFeet(distance){
let greeting;

if (distance <= 400) {
greeting = 'This one is on me!';
} else if (distance > 400 && distance <= 2000) {
greeting = 'That will be twenty bucks.';
} else if (distance > 2000 && distance < 2500) {
greeting = 'I will gladly take your thirty bucks.';
} else {
greeting = 'No can do.'
}
return greeting;
}

function ternaryCheckCity(){
// Write your code here!
function ternaryCheckCity(city){
return city === 'NYC' ? 'Ok, sounds good.' : 'No go.'
}

function switchOnCharmFromTip(){
// Write your code here!
function switchOnCharmFromTip(tip){
switch (tip) {
case 'generous':
return 'Thank you so much.'
break
case 'not as generous':
return 'Thank you.'
break
default:
return 'Bye.'
}
}