Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
60986de
docs: refactoring to subsections
Feb 17, 2023
9173f2d
docs: refactoring form4
Feb 17, 2023
e8f1bfc
docs: working on form4
Feb 17, 2023
250ad10
docs: getProductCountBySale for form4
Feb 17, 2023
57a4d1b
docs: fixed calls to getProductCountBySale
Feb 17, 2023
f34259f
docs: finished getProductCountByReturn for form4
Feb 17, 2023
cec5e2d
docs: getProductCountByReturn in correct section
Feb 17, 2023
6308f80
docs: setup sales report form4
Feb 17, 2023
7945191
test: removed unnessessary variable
Feb 17, 2023
b888289
fix: Fixed a bug on transaction types
Feb 21, 2023
24dc14f
docs: added file paths to comments
Feb 21, 2023
604c4d8
docs: added important files form4
Feb 21, 2023
00f21da
docs: refactoring form4
Feb 21, 2023
6b3ef81
docs: refactoring form4
Feb 21, 2023
a27136b
docs: added stubs for appliction docs
Feb 21, 2023
86bf585
docs: fixed spacing
Feb 21, 2023
9f7c148
docs: fixed minor things
Feb 21, 2023
a3a666e
docs: working on documenting app
Feb 21, 2023
5a1a243
feat: added more test data
Feb 21, 2023
3d40bf8
docs: working on app docs
Feb 21, 2023
790d018
docs: more app documentation
Feb 21, 2023
c5e1f99
docs: reorganized tests form4
Feb 22, 2023
a8fb957
docs: updated description form4
Feb 22, 2023
d2f6af7
docs: working on form4
Feb 22, 2023
a87667e
refactor: making names match
Feb 22, 2023
e7190a0
docs: working on form4
Feb 22, 2023
ecc05a3
docs: fixed some casing
Feb 22, 2023
60a24bb
docs: indicated that form4 was incomplete
Feb 22, 2023
6aff14c
docs: indicating all the forms to be documented
Feb 22, 2023
9f1fddb
docs: added files to app docs
Feb 22, 2023
d90abb6
docs: updating form4
Feb 22, 2023
7531032
docs: form 4
Feb 22, 2023
1eec2ae
docs: more form4
Feb 22, 2023
97330d6
docs: more form4
Feb 23, 2023
63672f1
docs: finished get sales report form4
Feb 23, 2023
e628490
docs: setup get returns report form4
Feb 23, 2023
1ad7d08
docs: finished get returns report form4
Feb 23, 2023
3d485a2
docs: finished form4
Feb 23, 2023
f7d584b
docs: marking form4 complete
Feb 23, 2023
adbfa4d
docs: added senpl as contributor
Feb 23, 2023
4211c27
docs: fixed senpl's contributions
Feb 23, 2023
48609be
docs: added willemlarsen to contribs
Feb 23, 2023
ec42345
docs: fixed willemlarsen contrib
Feb 23, 2023
c1c9dcc
docs: fixed type-o in comments
Feb 23, 2023
fd137be
docs: link to docs points to oner's repo
Feb 23, 2023
ec58cb2
docs: starting to break form1:variables
Feb 23, 2023
f77fa56
docs: broke variables up form1
Feb 23, 2023
4b7c88a
docs: making things uniform
Feb 24, 2023
3b3d6da
docs: standardized headings
Feb 24, 2023
76f1ec9
docs: standardizing capitalization
Feb 24, 2023
0860fd0
docs: unified quotation use
Feb 24, 2023
9fa1941
docs: breaking up form1 functions
Feb 24, 2023
7f07de8
docs: broke up form1 functions
Feb 24, 2023
0181ba8
docs: broke up form1 arrays
Feb 24, 2023
7a38349
docs: broke out complex form1
Feb 24, 2023
c445124
docs: broke up copying-arrays
Feb 24, 2023
912be00
docs: broke up combining form1
Feb 24, 2023
48a0db7
docs: broke up looping form1
Feb 24, 2023
213a95a
docs: removed old file
Feb 24, 2023
a04d237
docs: updated spacing form2
Feb 24, 2023
a983d1e
docs: updated spacing form3
Feb 24, 2023
092e398
fix: fixed reset files
Feb 28, 2023
e6d00d5
fix: restored comments from reset file
Feb 28, 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
18 changes: 18 additions & 0 deletions .all-contributorsrc
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,24 @@
"code",
"doc"
]
},
{
"login": "senpl",
"name": "Michał Urbanek",
"avatar_url": "https://avatars.githubusercontent.com/u/5415941?v=4",
"profile": "https://github.com/senpl",
"contributions": [
"bug"
]
},
{
"login": "willemlarsen",
"name": "Willem Larsen",
"avatar_url": "https://avatars.githubusercontent.com/u/3875136?v=4",
"profile": "http://thermodynamicsofemotion.com/",
"contributions": [
"doc"
]
}
],
"contributorsPerLine": 7,
Expand Down
1 change: 1 addition & 0 deletions .reset-files/3_third-form.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// eslint-disable-next-line
const jsforms = (function () {
'use strict';

Expand Down
46 changes: 24 additions & 22 deletions .reset-files/4_test-dummy-form.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,22 +29,22 @@ describe('Test Dummy Form - Costume Shop Sales', function () {
let salesReporter;

beforeEach(function () {
pointOfSaleDataUtilsFactory = pointOfSaleDataUtilsFactoryBuilder();
pointOfSaleDataUtilsFactory = pointOfSaleDataUtilityFactoryBuilder();
});

describe('Point of Sale Data Utilities', function () {
describe('get product count by sale', function () {

let pointOfSaleDataUtilities;
let transactionStatuses;
let testData;

beforeEach(function(){
testData = buildSimpleTestData();
transactionStatuses = buildTransactionStatuses();
pointOfSaleDataUtilities = pointOfSaleDataUtilsFactory(transactionStatuses);
});
// File being tested can be found here:
// ../jsforms-source/4_test-dummy-form/pos-transaction-services/pointOfSaleDataUtilsFactory.js

let pointOfSaleDataUtilities;
let transactionStatuses;

beforeEach(function () {
transactionStatuses = buildTransactionStatuses();
pointOfSaleDataUtilities = pointOfSaleDataUtilsFactory(transactionStatuses);
});

describe('get product count by sale', function () {
it('returns an empty object for sale counts if no sale data exists');

it('returns an object with a single count of 1 when only one item, quantity 1 was purchased');
Expand All @@ -64,22 +64,24 @@ describe('Test Dummy Form - Costume Shop Sales', function () {
});
});

describe('sales report', function () {
describe('get report', function () {
// files being tested are:
// ../jsforms-source/4_test-dummy-form/sales-reporter/salesReporterFactory.js
// ../jsforms-source/4_test-dummy-form/pos-transaction-services/reportDataBuilder.js
describe('get sales report', function () {
it('returns a sales report with no sales');
it('returns a report of sales with no sales');

it('returns a sales report with one sale');
it('returns a report of sales with one sale');

it('returns a sales report with two sales of different products');
it('returns a report of sales with two sales of different products');

it('returns a sales report with two sales of the same product');
it('returns a report of sales with two sales of the same product');

it('returns a sales report with no "returns" data');
it('returns a report of sales excluding any return transactions');
});
});

describe('returns report', function () {
it('returns a "returns" report with no "sales" data');
describe('get returns report', function () {
it('returns a report of return transactions that excludes sales transactions');
});
});

});
25 changes: 16 additions & 9 deletions .reset-files/6_async-test-dummy-form.test.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,27 @@
/* global httpService, pluginApi, asyncContacts */
/*
global

asyncContacts,
chai,
httpService,
pluginApi
*/

'use strict';

describe('Test Dummy Form', function () {
describe('Async Test Dummy Form', function () {

let contactService;
let responseData;

beforeEach(function () {
responseData = {};

const httpInstance = httpService();
const contactServiceInstance = contactService(httpInstance);
const pluginApiInstance = pluginApi();
return asyncContacts(contactServiceInstance, pluginApiInstance);

asyncContacts(contactServiceInstance, pluginApiInstance);
});

// For this first suite of tests, we are going to work with comparing strings
Expand All @@ -23,15 +33,14 @@ describe('Test Dummy Form', function () {
it('should return 0 when two values are equal');

// Equality checking is one of the most common ways to test
// the results of code, so it's important to get comnfortable with it
// the results of code, so it's important to get comfortable with it
it('should return -1 when name1 comes before name2 alphabetically');

// It's important to test all cases. The function, compareNames, has
// three distinct outcomes. One of the core ideas in testing your code
// is to test until you're bored. Ideally, being bored will come at
// about the same time you've tested all cases.
it('should return 1 when name1 comes after name2 alphabetically');

});

// Our second suite of tests will validate the behavior of a record comparison
Expand Down Expand Up @@ -60,7 +69,6 @@ describe('Test Dummy Form', function () {
// We could use the same record from the previous test to run this test case as well
// If this generates duplicate code, how would we resolve that?
it('should return 1 when last names are equal and record1.firstName comes after record3.firstName alphabetically');

});

describe('sortByContactName', function () {
Expand All @@ -75,15 +83,14 @@ describe('Test Dummy Form', function () {
// sortByContactName always returns an array, so a calling function
// doesn't fail on a type error
it('should return an empty array if passed argument is not an array');

});

describe('getContactNames', function () {

// To fix this issue you will need to understand how the Mockery
// library works. The beforeEach at the very top of this test will
// give you a place to start.
// Assert has a method "doesNothThrow." This would be quite useful here
// Assert has a method "doesNotThrow." This would be quite useful here
it('should not throw error immediately when called');

// Sinon is a library built for handling cases where you want to get a view
Expand Down
5 changes: 3 additions & 2 deletions FORMS.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@
1. [First Form](./docs/FIRST-FORM.md)
2. [Second Form](./docs/SECOND-FORM.md)
3. [Third Form](./docs/THIRD-FORM.md)
3. [Test Dummy Form](./docs/TEST-DUMMY-FORM.md)

4. [Test Dummy Form](./docs/TEST-DUMMY-FORM.md)
5. Async Form _TBD_
6. Async Test Dummy Form _TBD_


<!-- GENERATED DOCUMENT! DO NOT EDIT! -->
Expand Down
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,15 @@ For a video walkthrough of the setup process, check out the following video:


### Solving Each Form ###
1. [Documentation For all Forms](https://github.com/jason-kerney/jsLearnerForms/blob/documentation/FORMS.md)
1. [Documentation For all Forms](https://github.com/cmstead/jsLearnerForms/blob/documentation/FORMS.md)
2. First Form -- Write code to pass each test
1. [First Form Documentation](https://github.com/jason-kerney/jsLearnerForms/blob/documentation/docs/FIRST-FORM.md)
1. [First Form Documentation](https://github.com/cmstead/jsLearnerForms/blob/documentation/docs/FIRST-FORM.md)
3. Second Form -- Update code to pass new tests, keep old tests green
1. [Second Form Documentation](https://github.com/jason-kerney/jsLearnerForms/blob/documentation/docs/SECOND-FORM.md)
1. [Second Form Documentation](https://github.com/cmstead/jsLearnerForms/blob/documentation/docs/SECOND-FORM.md)
4. Third Form -- Update code to pass new tests, keep tests old green
1. [Third Form Documentation](https://github.com/jason-kerney/jsLearnerForms/blob/documentation/docs/THIRD-FORM.md)
1. [Third Form Documentation](https://github.com/cmstead/jsLearnerForms/blob/documentation/docs/THIRD-FORM.md)
5. Test Dummy Form (Fourth Form) -- Write tests matching each description and get all of the code under test (modify ONLY the test code)
1. [Test Dummy Form Documentation](https://github.com/jason-kerney/jsLearnerForms/blob/documentation/docs/TEST-DUMMY-FORM.md) **Incomplete**
1. [Test Dummy Form Documentation](https://github.com/cmstead/jsLearnerForms/blob/documentation/docs/TEST-DUMMY-FORM.md)
6. Async Form -- Write code to pass each test; don't forget the refactoring steps!
1. Documentation TBD
7. Async Test Dummy Form (Sixth Form) -- Write tests matching each description and get all of the code under test (modify ONLY the test code)
Expand Down Expand Up @@ -174,6 +174,8 @@ This section will be updated as forms are completed and ready for use.
<td align="center" valign="top" width="14.28%"><a href="https://github.com/hunterinderstries"><img src="https://avatars.githubusercontent.com/u/22056883?v=4?s=100" width="100px;" alt="hunterinderstries"/><br /><sub><b>hunterinderstries</b></sub></a><br /><a href="#financial-hunterinderstries" title="Financial">💵</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/edf-re"><img src="https://avatars.githubusercontent.com/u/13739273?v=4?s=100" width="100px;" alt="EDF Renewables"/><br /><sub><b>EDF Renewables</b></sub></a><br /><a href="#financial-edf-re" title="Financial">💵</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/jason-kerney"><img src="https://avatars.githubusercontent.com/u/5097968?v=4?s=100" width="100px;" alt="Jason Kerney"/><br /><sub><b>Jason Kerney</b></sub></a><br /><a href="https://github.com/cmstead/jsLearnerForms/commits?author=jason-kerney" title="Code">💻</a> <a href="https://github.com/cmstead/jsLearnerForms/commits?author=jason-kerney" title="Documentation">📖</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/senpl"><img src="https://avatars.githubusercontent.com/u/5415941?v=4?s=100" width="100px;" alt="Michał Urbanek"/><br /><sub><b>Michał Urbanek</b></sub></a><br /><a href="https://github.com/cmstead/jsLearnerForms/issues?q=author%3Asenpl" title="Bug reports">🐛</a></td>
<td align="center" valign="top" width="14.28%"><a href="http://thermodynamicsofemotion.com/"><img src="https://avatars.githubusercontent.com/u/3875136?v=4?s=100" width="100px;" alt="Willem Larsen"/><br /><sub><b>Willem Larsen</b></sub></a><br /><a href="https://github.com/cmstead/jsLearnerForms/commits?author=willemlarsen" title="Documentation">📖</a></td>
</tr>
</tbody>
</table>
Expand Down
15 changes: 7 additions & 8 deletions docs-source/forms-source/form1-doc/_main.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,15 @@
You can also look at [JS Learner Forms documentation](../FORMS.md) for other forms.

You will be working in then [jsforms-source/1_first-form.js](..\jsforms-source\1_first-form.js) file.

<!--bl
(table-of-contents
(section-main "./variables.md")
(section-main "./functions.md")
(section-main "./arrays.md")
(section-main "./complex.md")
(section-main "./copying-arrays.md")
(section-main "./combining.md")
(section-main "./looping.md")
(section-main "./variables/_main.md")
(section-main "./functions/_main.md")
(section-main "./arrays/_main.md")
(section-main "./complex/_main.md")
(section-main "./copying-arrays/_main.md")
(section-main "./combining/_main.md")
(section-main "./looping/_main.md")
(section-main "./otherForms.md")
)
/bl-->
11 changes: 11 additions & 0 deletions docs-source/forms-source/form1-doc/arrays/_main.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!--bl
(filemeta
(title "Arrays, Loops, and Function Calls")
)
/bl-->

You will use functions to work with arrays and loops.
<!--bl
(section "./sum.md")
(section "./square.md")
/bl-->
69 changes: 69 additions & 0 deletions docs-source/forms-source/form1-doc/arrays/square.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
<!--bl
(filemeta
(title "Square All Function")
)
/bl-->

Create a function that squares each number in an array.

The steps you will take to building the `squareAll` function are:

1. Add a `squareAll` function that returns a constant value.
2. Chang the `squareAll` function to perform square computation on array value

#### It should square all numbers in a single-value array ####

Create a function called `squareAll` that takes an array and returns the square of the first element.

<details><summary>Hints</summary>

Create a function that only squares the first value of an array and returns that value as an array.

<details><summary>Code</summary>

**Example**

```javascript
function squareAll (values) {
let result = square(_array_[_number_]);
return [_something_];
}

return {
squareAll,
};
```

</details>

</details>

#### It should square multiple numbers ####

Modify the `squareAll` function so that it now squares each number in the array.

<details><summary>Hints</summary>

Add logic to square all numbers in array (How did you solve sum?)

<details><summary>Code</summary>

**Example**

```javascript
function squareAll (values) {
for(let index = _number_; _number_ < _number_; index += 1) {
result[index] = square(_something_[index]);
}

return ?;
}

return {
squareAll,
};
```

</details>

</details>
Loading