fix weird merge
This commit is contained in:
parent
829730fb79
commit
08c3973e7b
|
@ -1,3 +0,0 @@
|
||||||
The goal of this exercise is to introduce you to the concept of objects and classes. These are fundamental building blocks for OOP (Object Oriented Programming). You shouldn't need to write a ton of new code, in fact you can re-use your solution from the Simon Says exercise!
|
|
||||||
|
|
||||||
The key here will be rewriting certain bits of it to work within the class given to you.
|
|
|
@ -1,8 +0,0 @@
|
||||||
class bookTitle {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
bookTitle
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,64 +0,0 @@
|
||||||
var bookTitles = require ('./bookTitles.js');
|
|
||||||
|
|
||||||
describe('bookTitle', function() {
|
|
||||||
|
|
||||||
var book; // note the scope here, if you declare this inside beforeEach then the scope won't allow it to access the other specs
|
|
||||||
|
|
||||||
beforeEach(function() {
|
|
||||||
book = new bookTitles.bookTitle(); // creates a new book instance before each test is run
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('title', function() {
|
|
||||||
|
|
||||||
it('should capitalize the first letter', function() {
|
|
||||||
book.title = 'inferno';
|
|
||||||
expect(book.title).toEqual('Inferno');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should capitalize every word', function() {
|
|
||||||
book.title = 'stuart little';
|
|
||||||
expect(book.title).toEqual('Stuart Little');
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('should capitalize every word except...', function() {
|
|
||||||
describe('articles', function() {
|
|
||||||
it('does not capitalize "the"', function() {
|
|
||||||
book.title = 'alexander the great';
|
|
||||||
expect(book.title).toEqual('Alexander the Great');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('does not capitalize "a"', function() {
|
|
||||||
book.title = 'to kill a mockingbird';
|
|
||||||
expect(book.title).toEqual('To Kill a Mockingbird');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('does not capitalize "an"', function() {
|
|
||||||
book.title = 'to eat an apple a day';
|
|
||||||
expect(book.title).toEqual('To Eat an Apple a Day');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it('conjunctions', function() {
|
|
||||||
book.title = 'war and peace';
|
|
||||||
expect(book.title).toEqual('War and Peace');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('prepositions', function() {
|
|
||||||
book.title = 'love in the time of cholera';
|
|
||||||
expect(book.title).toEqual('Love in the Time of Cholera');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('should always capitalize...', function() {
|
|
||||||
it('I', function() {
|
|
||||||
book.title = 'what i wish i knew when i was 20';
|
|
||||||
expect(book.title).toEqual('What I Wish I Knew When I Was 20');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('the first word', function() {
|
|
||||||
book.title = 'the man in the iron mask';
|
|
||||||
expect(book.title).toEqual('The Man in the Iron Mask');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
|
@ -1,11 +0,0 @@
|
||||||
The goal of this exercise is for you to create a timer. The timer will operate with the following format:
|
|
||||||
|
|
||||||
00:00:00
|
|
||||||
|
|
||||||
You will be given an object with the value of seconds already added. Your job is to use the class to add a string containing the timer result to this original object.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
12 seconds given
|
|
||||||
|
|
||||||
00:00:12 should be the output
|
|
|
@ -1,7 +0,0 @@
|
||||||
class timeFormat {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
timeFormat
|
|
||||||
}
|
|
|
@ -1,35 +0,0 @@
|
||||||
var Timer = require ('./timer.js');
|
|
||||||
|
|
||||||
describe('Timer', function() {
|
|
||||||
var timer; // undefined, here for scope purposes
|
|
||||||
|
|
||||||
beforeEach(function () {
|
|
||||||
timer = new Timer.timeFormat();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should initialize to 0 seconds', function() {
|
|
||||||
expect(timer.seconds).toEqual(0); // makes sure timer starts with 0 seconds
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('time_string', function() {
|
|
||||||
it('should display 0 seconds as 00:00:00', function() {
|
|
||||||
timer.seconds = 0;
|
|
||||||
expect(timer.time_string()).toEqual("00:00:00");
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should display 12 seconds as 00:00:12', function() {
|
|
||||||
timer.seconds = 12;
|
|
||||||
expect(timer.time_string()).toEqual("00:00:12");
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should display 66 seconds as 00:01:06', function() {
|
|
||||||
timer.seconds = 66;
|
|
||||||
expect(timer.time_string()).toEqual("00:01:06");
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should display 4000 seconds as 01:06:40', function() {
|
|
||||||
timer.seconds = 4000;
|
|
||||||
expect(timer.time_string()).toEqual("01:06:40");
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
Loading…
Reference in New Issue