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-05T18:39:07.720Z",
"end": "2025-05-05T18:39:07.830Z",
"duration": 110
},
"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": {}
}
]
}
35 changes: 29 additions & 6 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,34 @@
function scuberGreetingForFeet(){
// Write your code here!
function scuberGreetingForFeet(feet){
if (feet <= 400){
return 'This one is on me!'
}
else {
if (feet <= 2000){
return 'That will be twenty bucks.'
}
else {
if (feet <= 2500){
return 'I will gladly take your thirty bucks.'
}
else {
return 'No can do.'
}
}
}
Comment on lines +1 to +17

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you have extra time, trying giving this a refactor!

}

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.'
case 'not as generous':
return 'Thank you.'
default:
return 'Bye.'
}

}