Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jamies branch #104

Open
wants to merge 32 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
6e11845
Write createDragon function and pass all tests
JamieCaudill Mar 27, 2023
b3be681
write greetRider function and delete skips in test
JamieCaudill Mar 27, 2023
9c2141c
modify createDragon function to include timesEaten and hungry key-val…
JamieCaudill Mar 28, 2023
6cf7a6f
Write eat function
JamieCaudill Mar 28, 2023
ddbec3b
Write aggressiveDragons function
JamieCaudill Mar 28, 2023
5aeca4d
Merge pull request #1 from JamieCaudill/jamies_branch
JamieCaudill Mar 28, 2023
3ac7ad6
Write createHobbit function
JamieCaudill Mar 29, 2023
84de179
Pass tests for celebrateBirthday
JamieCaudill Mar 31, 2023
d0b2452
Pass tests for getRing
JamieCaudill Mar 31, 2023
87a14e6
Pass final hobbit tests
JamieCaudill Apr 2, 2023
5e14a3a
Write createVampire function and pass tests
JamieCaudill Apr 2, 2023
c8c78ed
Write encounterDeliciousVictim function
JamieCaudill Apr 2, 2023
db8161d
Write drink function and modify encounterDeliciousVictim function
JamieCaudill Apr 2, 2023
30959b8
Write inquirePlace function
JamieCaudill Apr 2, 2023
2e0ce2e
Write findBatLovers function
JamieCaudill Apr 2, 2023
fd14a74
Pass all tests for birthdays
JamieCaudill Apr 3, 2023
5a7114f
Pass all tests for airport
JamieCaudill Apr 3, 2023
2cf04ab
Merge pull request #2 from JamieCaudill/jamies_branch
JamieCaudill Apr 3, 2023
32cf753
Write cutHair function
JamieCaudill Apr 6, 2023
1aabb15
Pass all barber-shop tests
JamieCaudill Apr 6, 2023
7aea407
Pass all tests for calendar
JamieCaudill Apr 9, 2023
b9d47c6
Merge remote-tracking branch 'origin' into jamies_branch
JamieCaudill Apr 12, 2023
872927e
Pass all tests for dj
JamieCaudill Apr 12, 2023
8c430e6
Pass all tests for dollar-store-vending-machine
JamieCaudill Apr 12, 2023
da2e5f2
Pass all tests for elevator.js
JamieCaudill Apr 14, 2023
06a810f
Pass all tests for favorite-foods
JamieCaudill Apr 15, 2023
a19eb9d
Pass all tests for library
JamieCaudill Apr 15, 2023
f28002c
Pass all tests for meal-planning
JamieCaudill Apr 15, 2023
b44dbe3
Pass all tests for restaurant
JamieCaudill Apr 16, 2023
db70b66
Pass all tests for spa
JamieCaudill Apr 16, 2023
fea46ab
Pass all tests for spotify
JamieCaudill Apr 17, 2023
f8a2e21
Pass all tests for tacoStand
JamieCaudill Apr 19, 2023
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
10 changes: 5 additions & 5 deletions airport/airport-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ var assert = require('chai').assert;
var { createAirport, welcomeGuests, landPlanes, checkAirlineLocations } = require('./airport');

describe('Airport', function() {
it.skip('should create an airport', function() {
it('should create an airport', function() {
var airport = createAirport('Denver International Airport', ['United', 'Southwest', 'Delta'], 144);

assert.equal(airport.name, 'Denver International Airport');
assert.equal(airport.availableGates, 144);
assert.equal(airport.airlines[0], 'United');
});

it.skip('should welcome people to the airport', function() {
it('should welcome people to the airport', function() {
var denverAirport = createAirport('Denver International Airport', ['United', 'Southwest', 'Delta'], 144);
var sanDiegoAirport = createAirport('San Diego International Airport', ['Frontier', 'American'], 48);

Expand All @@ -22,7 +22,7 @@ describe('Airport', function() {
assert.equal(sanDiegoWelcome, 'Welcome to San Diego International Airport!');
});

it.skip('should keep track of open gates', function() {
it('should keep track of open gates', function() {
var bakersfieldAirport = createAirport('Meadows Field Airport', ['United', 'American'], 12);
var sanDiegoAirport = createAirport('San Diego International Airport', ['Frontier', 'American'], 48);

Expand All @@ -33,7 +33,7 @@ describe('Airport', function() {
assert.equal(sanDiegoAirport.availableGates, 46);
});

it.skip('should not be able to occupy more gates than available', function() {
it('should not be able to occupy more gates than available', function() {
var columbusAiport = createAirport('John Glenn Airport', ['Southwest', 'Frontier'], 24);

var occupiedGates1 = landPlanes(columbusAiport, 22);
Expand All @@ -47,7 +47,7 @@ describe('Airport', function() {
assert.equal(occupiedGates2, 'Oh no! Not enough gates available. Current overflow is 1.')
});

it.skip('should be able to tell you where an airline flies to', function() {
it('should be able to tell you where an airline flies to', function() {
var columbusAiport = createAirport('John Glenn Airport', ['Southwest', 'Frontier'], 24);
var bakersfieldAirport = createAirport('Meadows Field Airport', ['United', 'American'], 12);
var sanDiegoAirport = createAirport('San Diego International Airport', ['Frontier', 'American'], 48);
Expand Down
45 changes: 41 additions & 4 deletions airport/airport.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,45 @@


module.exports = {
// createAirport,
// welcomeGuests,
// landPlanes,
// checkAirlineLocations
createAirport,
welcomeGuests,
landPlanes,
checkAirlineLocations
};

function createAirport(location, airlines, gates) {
var airport = {
name: location,
availableGates: gates,
airlines: airlines
}
return airport;
}

function welcomeGuests(airport) {
return `Welcome to ${airport.name}!`
}

function landPlanes(airport, planes) {
airport.availableGates = airport.availableGates - planes;
if (airport.availableGates > 0) {
return `Success! Current availability is ${airport.availableGates}.`;
}
if (airport.availableGates <= 0) {
var overflow = airport.availableGates * -1;
airport.availableGates = 0;
return `Oh no! Not enough gates available. Current overflow is ${overflow}.`
}
}

function checkAirlineLocations(airports, airline) {
var carriers = [];
for (var i = 0; i < airports.length; i++) {
for (var j = 0; j < airports[i].airlines.length; j++) {
if (airline === airports[i].airlines[j]) {
carriers.push(airports[i].name)
}
}
}
return carriers;
}
14 changes: 7 additions & 7 deletions barber-shop/barber-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ var assert = require('chai').assert;
var { createBarber, giveCompliment, cutHair, listStyles } = require('./barber');

describe('Barber', function() {
it.skip('should create a barber with a name', function() {
it('should create a barber with a name', function() {
var sam = createBarber('Sam');

assert.equal(sam.name, 'Sam');
})

it.skip('should be able to have earnings and known haircuts', function() {
it('should be able to have earnings and known haircuts', function() {
var cut1 = { style: 'mohawk', hairLength: 'short', price: 11.00 };
var cut2 = { style: 'side part', hairLength: 'medium', price: 12.00 };

Expand All @@ -19,7 +19,7 @@ describe('Barber', function() {
assert.deepEqual(erin.haircuts, [cut1, cut2]);
});

it.skip('should default to no earnings and no haircuts if none provided', function() {
it('should default to no earnings and no haircuts if none provided', function() {
var buzzCut = { style: 'buzz', hairLength: 'short', price: 8.00 };
var nick = createBarber('Nick', 8.00, [buzzCut]);

Expand All @@ -32,7 +32,7 @@ describe('Barber', function() {
assert.deepEqual(pam.haircuts, []);
});

it.skip('should be able to offer a compliment', function() {
it('should be able to offer a compliment', function() {
var mohawkCut = { style: 'mohawk', hairLength: 'short', price: 11.00 };
var buzzCut = { style: 'buzz', hairLength: 'short', price: 8.00 };

Expand All @@ -45,7 +45,7 @@ describe('Barber', function() {
assert.equal(buzzCompliment, 'This buzz looks great!');
});

it.skip('should be able to cut hair', function() {
it('should be able to cut hair', function() {
var matt = createBarber('Matt');

var mohawkCut = { style: 'mohawk', hairLength: 'short', price: 11.00 };
Expand All @@ -64,7 +64,7 @@ describe('Barber', function() {
assert.deepEqual(mattCanDoMohawkAndBuzz.haircuts, [ mohawkCut, buzzCut ]);
});

it.skip('should earn money for hair cuts', function() {
it('should earn money for hair cuts', function() {
var erin = createBarber('Erin');

var buzzCut = { style: 'buzz', hairLength: 'short', price: 8.00 };
Expand All @@ -79,7 +79,7 @@ describe('Barber', function() {
assert.equal(erinCanDoBuzzAndSidePart.earnings, 18.00);
});

it.skip('should be able to list style options based on desired length', function() {
it('should be able to list style options based on desired length', function() {
var buzzCut = { style: 'buzz', hairLength: 'short', price: 8.00 };
var sidePartCut = { style: 'side part', hairLength: 'medium', price: 10.00 };
var bobCut = { style: 'bob', hairLength: 'short', price: 12.00 };
Expand Down
52 changes: 51 additions & 1 deletion barber-shop/barber.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,53 @@


module.exports = { };
module.exports = {
createBarber,
giveCompliment,
cutHair,
listStyles
};

function createBarber(name, earnings, cuts) {
var barber = {
name: name,
earnings: earnings,
haircuts: cuts
}
if (earnings === undefined) {
barber.earnings = 0;
}
if (cuts === undefined) {
barber.haircuts = [];
}
return barber;
}

function giveCompliment(cut) {
return `This ${cut.style} looks great!`;
}

function cutHair(barber, haircut) {
// take haircut and push it into haircuts array
var counter = 0;
barber.haircuts.push(haircut);
for (var i = 0; i < barber.haircuts.length; i++) {
counter = counter + barber.haircuts[i].price;
}
barber.earnings = counter;
return barber;
}

// should earn money for haircuts
// create a for loop that iterates through the haircuts array in the barber object
// add each of the numbers under price and add them to empty counter variable
// push counter into earnings.

function listStyles(barber, haircutLength) {
var styles = [];
for (var i = 0; i < barber.haircuts.length; i++) {
if (barber.haircuts[i].hairLength === haircutLength) {
styles.push(barber.haircuts[i].style)
}
}
return styles;
}
6 changes: 3 additions & 3 deletions birthdays/birthdays-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ var assert = require('chai').assert;
var { createBirthday, celebrateBirthday, countBirthdays } = require('./birthdays');

describe('Birthdays', function() {
it.skip('should create birthdays', function() {
it('should create birthdays', function() {
var leahBirthday = createBirthday('Leah', 2, 10);
var christyBirthday = createBirthday('Christy', 3, 8);

Expand All @@ -15,7 +15,7 @@ describe('Birthdays', function() {
assert.deepEqual(christyBirthday.day, 8);
});

it.skip('should celebrate birthdays', function() {
it('should celebrate birthdays', function() {
var alexBirthday = createBirthday('Alex', 5, 19);

var celebrateAlex = celebrateBirthday(alexBirthday);
Expand All @@ -29,7 +29,7 @@ describe('Birthdays', function() {
assert.equal(celebrateHeather, 'Today is 6/29! Happy birthday, Heather!');
})

it.skip('should count how many birthdays are in a given month', function() {
it('should count how many birthdays are in a given month', function() {
var leahBirthday = createBirthday('Leah', 2, 10);
var christyBirthday = createBirthday('Christy', 3, 8);
var alexBirthday = createBirthday('Alex', 5, 19);
Expand Down
29 changes: 28 additions & 1 deletion birthdays/birthdays.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,30 @@
function createBirthday(name, month, day) {
var birthdays = {
name: name,
month: month,
day: day,
}
return birthdays;
}

function celebrateBirthday (birthday){
var name = birthday.name
var month = birthday.month
var day = birthday.day
return `Today is ${month}/${day}! Happy birthday, ${name}!`
}

module.exports = { };
function countBirthdays(birthdays, month) {
birthdaysCounter = 0;
for (var i = 0; i < birthdays.length; i++) {
if (birthdays[i].month === month) {
birthdaysCounter++;
}
}
return birthdaysCounter;
}
module.exports = {
createBirthday,
celebrateBirthday,
countBirthdays
};
8 changes: 4 additions & 4 deletions calendar/calendar-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ var { createEvent, createCalendar, reportMonthlyEvents } = require('./calendar')

describe('Calendar', function () {

it.skip('should create an event', function () {
it('should create an event', function () {
var event = createEvent("Go to the Park", "August", 25);

assert.equal(event.title, "Go to the Park");
Expand All @@ -18,15 +18,15 @@ describe('Calendar', function () {
assert.equal(event2.day, 1);
});

it.skip('should return an error if an invalid day is passed in', function () {
it('should return an error if an invalid day is passed in', function () {
var event1 = createEvent("Go to the Park", "August", 35);
assert.equal(event1, "Error: 35 is not a valid day");

var event2 = createEvent("Go to the Park", "August", 0);
assert.equal(event2, "Error: 0 is not a valid day");
});

it.skip('should create a calendar with events', function () {
it('should create a calendar with events', function () {
var event1 = createEvent("Go to the Park", "August", 25);
var event2 = createEvent("Dinner with Lucy", "September", 10);
var events = [event1, event2];
Expand All @@ -43,7 +43,7 @@ describe('Calendar', function () {
assert.deepEqual(calendar2.events, [event1, event2]);
});

it.skip('should gather events from the same month', function () {
it('should gather events from the same month', function () {
var event1 = createEvent("Go to the Park", "August", 25);
var event2 = createEvent("Dinner with Lucy", "July", 10);
var event3 = createEvent("Order More Batteries", "July", 2);
Expand Down
37 changes: 36 additions & 1 deletion calendar/calendar.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,38 @@


module.exports = { };
module.exports = {
createEvent,
createCalendar,
reportMonthlyEvents
};

function createEvent(title, month, day) {
if (day > 0 && day < 32) {
var event = {
title: title,
month: month,
day: day
}
return event;
} else {
return `Error: ${day} is not a valid day`
}
};

function createCalendar(name, events) {
var calendar = {
owner: name,
events: events
}
return calendar;
};

function reportMonthlyEvents(calendar, monthCheck) {
var monthEvent = [];
for (var i = 0; i < calendar.events.length; i++) {
if (calendar.events[i].month === monthCheck) {
monthEvent.push(calendar.events[i])
}
}
return monthEvent;
};
Loading