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

remove next lession's questions #10

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
50 changes: 30 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,43 +2,53 @@
An npm functional programming library project

1. Fork this repository to your own GitHub account.

2. Clone your forked version of the lodown repository to a new Cloud9 workspace or locally if you prefer.

3. To create a `package.json` configuration file for our lodown library, from the command-line, run the command:

npm init

4. **IMPORTANT CONFIGURATION**: Fill in the prompts with your own details:
1. When asked for **test command**, enter:

1. When asked for a project name, give the it a name following this pattern:

`lodown-yourGitHubUsername`

2. When asked for **test command**, enter:

`istanbul cover _mocha -- test/ -R spec`

2. When asked for your **git repository**, you will probably be given the correct url as the default, so just select this by pressing `return`, otherwise, provide **your forked GitHub repository's url**.
3. When asked for your **git repository**, you will probably be given the correct url as the default, so just select this by pressing `return`, otherwise, provide **your forked GitHub repository's url**.

5. Install the required test libraries by running the following command:

npm install i -D mocha chai sinon istanbul
6. Write your tests in the file `test/index.spec.js`. Check out the [chai api for ](http://chaijs.com/api/bdd/) and [be careful when asserting/expecting against complex types](http://stackoverflow.com/questions/17526805/chai-test-array-equality-doesnt-work-as-expected) - you'll have to make use of the `.eql` api, and not `.equal`. For example:

expect(lodown.filter([1, 2, 3], function(value) { return value > 2; } )).to.eql([3]);
7. Implement your library in the file `index.js`. Remember that `index.js` is a Node.js module, so you must export your API using, for example:

6. Implement your library in the file `index.js`. Remember that `index.js` is a Node.js module, so you must export your API using, for example:

module.exports.each = each;
8. To run your tests, run the following command:

7. Using the `each` function provided as an example, rewrite the comments from your underpants library
so that they act as live code hints as you work in your module.

8. Release your lodown library to `npm` (node package manager), by following the steps on this page to do so:

npm test
9. Check the console output for passes and failures.
10. Preview (Cloud9) or open the file at `coverage/lcov-report/index.html` for your coverage report. Make certain all lines of code are traversed in your tests!
[**Publishing NPM Packages**](https://docs.npmjs.com/getting-started/publishing-npm-packages)

## Solve
**BONUS:** Create unit tests for your library:

1. Write your tests in the file `test/index.spec.js`. Check out the [chai api for ](http://chaijs.com/api/bdd/) and [be careful when asserting/expecting against complex types](http://stackoverflow.com/questions/17526805/chai-test-array-equality-doesnt-work-as-expected) - you'll have to make use of the `.eql` api, and not `.equal`. For example:

expect(lodown.filter([1, 2, 3], function(value) { return value > 2; } )).to.eql([3]);

2. To run your tests, run the following command:

npm test

Using the file at `test/fixtures/customers.json`, and utilizing your lodown library, write functions that take the Array of customers and return the following:
3. Check the console output for passes and failures.

1. how many males, how many females
2. oldest customer, youngest customer
3. average balance
4. how many customer's names begin with some letter
5. how many customer's friend's names begin with some letter
6. how many customers are friends
7. how many customers have friends in common
8. most common tags
4. Preview (Cloud9) or open the file at `coverage/lcov-report/index.html` for your coverage report. Make certain all lines of code are traversed in your tests!

## Resources:

Expand Down