Merge branch 'chore/switch-to-jest' into jest-solutions
This commit is contained in:
commit
a1c56276ea
|
@ -14,7 +14,7 @@ Before you start you should have a few things installed on your machine:
|
|||
|
||||
Each exercise includes 3 files: a markdown file with a description of the task, an empty (or mostly empty) JavaScript file, and a set of tests. To complete an exercise, you'll need to go to the exercise directory with `cd exerciseName` in the terminal and run `npm test exerciseName.spec.js`. This should run the test file and show you the output. When you first run a test, it will fail. This is by design! You must open the exercise file and write the code needed to get the test to pass. Some of the exercises have test conditions defined in their spec file that are defined as 'test.skip' compared to 'test'. This is purposeful. After you pass your first 'test', you will change the next 'test.skip' to an 'test' and test your code again. You'll do this until all conditions are satisfied.
|
||||
|
||||
**Note**: Due to the way Jest handles failed tests, it will return an etest.skip code of 1 if any tests fail. NPM will interpret this as an error and you may see some `npm ERR!` messages after Jest runs. You can ignore these, or run your test with `npm test exerciseName.spec.js --silent` to supress the errors.
|
||||
**Note**: Due to the way Jest handles failed tests, it may return an exit code of 1 if any tests fail. NPM will interpret this as an error and you may see some `npm ERR!` messages after Jest runs. You can ignore these, or run your test with `npm test exerciseName.spec.js --silent` to supress the errors.
|
||||
|
||||
The first exercise, `helloWorld`, will walk you through the process in-depth.
|
||||
|
||||
|
|
|
@ -4,19 +4,19 @@ describe('findTheOldest', () => {
|
|||
test('finds the oldest person!', () => {
|
||||
const people = [
|
||||
{
|
||||
name: 'Carly',
|
||||
name: "Carly",
|
||||
yearOfBirth: 1942,
|
||||
yearOfDeath: 1970,
|
||||
},
|
||||
{
|
||||
name: 'Ray',
|
||||
name: "Ray",
|
||||
yearOfBirth: 1962,
|
||||
yearOfDeath: 2011
|
||||
yearOfDeath: 2011,
|
||||
},
|
||||
{
|
||||
name: 'Jane',
|
||||
name: "Jane",
|
||||
yearOfBirth: 1912,
|
||||
yearOfDeath: 1941
|
||||
yearOfDeath: 1941,
|
||||
},
|
||||
]
|
||||
expect(findTheOldest(people).name).toBe('Ray');
|
||||
|
@ -24,18 +24,18 @@ describe('findTheOldest', () => {
|
|||
test.skip('finds the oldest person if someone is still living', () => {
|
||||
const people = [
|
||||
{
|
||||
name: 'Carly',
|
||||
name: "Carly",
|
||||
yearOfBirth: 2018,
|
||||
},
|
||||
{
|
||||
name: 'Ray',
|
||||
name: "Ray",
|
||||
yearOfBirth: 1962,
|
||||
yearOfDeath: 2011
|
||||
yearOfDeath: 2011,
|
||||
},
|
||||
{
|
||||
name: 'Jane',
|
||||
name: "Jane",
|
||||
yearOfBirth: 1912,
|
||||
yearOfDeath: 1941
|
||||
yearOfDeath: 1941,
|
||||
},
|
||||
]
|
||||
expect(findTheOldest(people).name).toBe('Ray');
|
||||
|
@ -43,21 +43,20 @@ describe('findTheOldest', () => {
|
|||
test.skip('finds the oldest person if the OLDEST is still living', () => {
|
||||
const people = [
|
||||
{
|
||||
name: 'Carly',
|
||||
name: "Carly",
|
||||
yearOfBirth: 1066,
|
||||
},
|
||||
{
|
||||
name: 'Ray',
|
||||
name: "Ray",
|
||||
yearOfBirth: 1962,
|
||||
yearOfDeath: 2011
|
||||
yearOfDeath: 2011,
|
||||
},
|
||||
{
|
||||
name: 'Jane',
|
||||
name: "Jane",
|
||||
yearOfBirth: 1912,
|
||||
yearOfDeath: 1941
|
||||
yearOfDeath: 1941,
|
||||
},
|
||||
]
|
||||
expect(findTheOldest(people).name).toBe('Carly');
|
||||
});
|
||||
|
||||
});
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
let <%= title %> = function() {
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = <%= title %>
|
||||
module.exports = <%= title %>;
|
||||
|
|
|
@ -1140,7 +1140,7 @@
|
|||
"dev": true,
|
||||
"requires": {
|
||||
"onetime": "^2.0.0",
|
||||
"signal-etest.skip": "^3.0.2"
|
||||
"signal-exit": "^3.0.2"
|
||||
}
|
||||
},
|
||||
"string-width": {
|
||||
|
@ -1271,9 +1271,9 @@
|
|||
"merge": "^1.1.3"
|
||||
}
|
||||
},
|
||||
"etest.skip-hook": {
|
||||
"exit-hook": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/etest.skip-hook/-/etest.skip-hook-1.1.1.tgz",
|
||||
"resolved": "https://registry.npmjs.org/exit-hook/-/exit-hook-1.1.1.tgz",
|
||||
"integrity": "sha1-8FyiM7SMBdVP/wd2XfhQfpXAL/g="
|
||||
},
|
||||
"expand-brackets": {
|
||||
|
@ -4225,7 +4225,7 @@
|
|||
"resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-1.0.1.tgz",
|
||||
"integrity": "sha1-NGYfRohjJ/7SmRR5FSJS35LapUE=",
|
||||
"requires": {
|
||||
"etest.skip-hook": "^1.0.0",
|
||||
"exit-hook": "^1.0.0",
|
||||
"onetime": "^1.0.0"
|
||||
}
|
||||
},
|
||||
|
@ -4373,9 +4373,9 @@
|
|||
"integrity": "sha512-vFwSUfQvqybiICwZY5+DAWIPLKsWO31Q91JSKl3UYv+K5c2QRPzn0qzec6QPu1Qc9eHYItiP3NdJqNVqetYAww==",
|
||||
"dev": true
|
||||
},
|
||||
"signal-etest.skip": {
|
||||
"signal-exit": {
|
||||
"version": "3.0.2",
|
||||
"resolved": "https://registry.npmjs.org/signal-etest.skip/-/signal-etest.skip-3.0.2.tgz",
|
||||
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz",
|
||||
"integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=",
|
||||
"dev": true
|
||||
},
|
||||
|
@ -5515,7 +5515,7 @@
|
|||
"dev": true,
|
||||
"requires": {
|
||||
"onetime": "^2.0.0",
|
||||
"signal-etest.skip": "^3.0.2"
|
||||
"signal-exit": "^3.0.2"
|
||||
}
|
||||
},
|
||||
"string-width": {
|
||||
|
|
|
@ -15,5 +15,4 @@ describe('getTheTitles', () => {
|
|||
test('gets titles', () => {
|
||||
expect(getTheTitles(books)).toEqual(['Book','Book2']);
|
||||
});
|
||||
|
||||
});
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -14,11 +14,11 @@
|
|||
},
|
||||
"homepage": "https://github.com/TheOdinProject/javascript-exercises#readme",
|
||||
"devDependencies": {
|
||||
"jest": "^26.6.3",
|
||||
"jest-cli": "^26.6.3",
|
||||
"eslint": "^7.26.0",
|
||||
"eslint-config-airbnb-base": "^14.2.1",
|
||||
"eslint-plugin-import": "^2.22.1"
|
||||
"eslint-plugin-import": "^2.22.1",
|
||||
"jest": "^26.6.3",
|
||||
"jest-cli": "^26.6.3"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "jest"
|
||||
|
|
|
@ -19,5 +19,4 @@ describe('palindromes', () => {
|
|||
test.skip('doesn\'t just always return true', () => {
|
||||
expect(palindromes('ZZZZ car, a man, a maraca.')).toBe(false);
|
||||
});
|
||||
|
||||
});
|
||||
|
|
|
@ -16,6 +16,6 @@ const firstVowelIndex = function(string) {
|
|||
return string.indexOf(vowels[1]);
|
||||
}
|
||||
return string.indexOf(vowels[0]);
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = pigLatin;
|
||||
|
|
|
@ -19,7 +19,6 @@ const removeFromArray = function (...args) {
|
|||
return newArray;
|
||||
};
|
||||
|
||||
|
||||
// A simpler, but more advanced way to do it is to use the 'filter' function,
|
||||
// which basically does what we did with the forEach above.
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ describe('repeatString', () => {
|
|||
|
||||
// DO NOT use Math.floor(Math.random() * 1000) in your code,
|
||||
// this test generates a random number, then passes it into your code with a function parameter.
|
||||
// If this doesn't make sense, you should go read about functions here: https://www.theodinproject.com/courses/web-development-101/lessons/fundamentals-part-3
|
||||
// If this doesn't make sense, you should go read about functions here: https://www.theodinproject.com/paths/foundations/courses/foundations/lessons/fundamentals-part-3
|
||||
const number = Math.floor(Math.random() * 1000)
|
||||
/*The .match(/((hey))/g).length is a regex that will count the number of heys
|
||||
in the result, which if your function works correctly will equal the number that
|
||||
|
|
|
@ -19,5 +19,4 @@ describe('snakeCase', () => {
|
|||
test.skip('works with WTF case', () => {
|
||||
expect(snakeCase('SnAkE..CaSe..Is..AwEsOmE')).toEqual('snake_case_is_awesome');
|
||||
});
|
||||
|
||||
});
|
||||
|
|
|
@ -6,6 +6,7 @@ const ctof = function(c) {
|
|||
return Math.round(((c * 9/5) + 32) * 10) / 10
|
||||
};
|
||||
|
||||
|
||||
module.exports = {
|
||||
ftoc,
|
||||
ctof
|
||||
|
|
Loading…
Reference in New Issue