Skip to content

Commit ce86675

Browse files
authored
Merge branch 'CodeYourFuture:main' into coursework/sprint-1
2 parents 0d13cdf + 124ae45 commit ce86675

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+495
-584
lines changed

.github/FUNDING.yml

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,2 @@
1-
# These are supported funding model platforms
2-
31
github: CodeYourFuture
4-
patreon: # Replace with a single Patreon username
5-
open_collective: # Replace with a single Open Collective username
6-
ko_fi: # Replace with a single Ko-fi username
7-
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8-
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9-
liberapay: # Replace with a single Liberapay username
10-
issuehunt: # Replace with a single IssueHunt username
11-
otechie: # Replace with a single Otechie username
12-
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
132
custom: https://codeyourfuture.io/donate

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 0 additions & 14 deletions
This file was deleted.

.github/ISSUE_TEMPLATE/pd-assignment.yml

Lines changed: 0 additions & 59 deletions
This file was deleted.

.github/ISSUE_TEMPLATE/tech-ed-assignment.yml

Lines changed: 0 additions & 80 deletions
This file was deleted.

.github/pull_request_template.md

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,30 @@
22
33
You must title your PR like this:
44
5-
REGION | COHORT_NAME | FIRST_NAME LAST_NAME | PROJ_NAME
5+
Region | Cohort | FirstName LastName | Sprint | Assignment Title
66
77
For example,
88
9-
London | May-2025 | Carol Owen | Sprint-1
9+
London | 25-ITP-May | Carol Owen | Sprint 1 | Alarm Clock
1010
11-
Complete the task list below this message.
12-
If your PR is rejected, check the task list.
11+
Fill in the template below - remove any sections that don't apply.
12+
13+
Complete the self checklist - replace each empty box in the checklist [ ] with a [x].
14+
15+
Add the label "Needs Review" and you will get review.
16+
17+
Respond to volunteer reviews until the volunteer marks it as "Complete".
1318
1419
-->
1520

1621
## Learners, PR Template
1722

1823
Self checklist
1924

20-
- [ ] I have committed my files one by one, on purpose, and for a reason
21-
- [ ] I have titled my PR with REGION | COHORT_NAME | FIRST_NAME LAST_NAME | PROJ_NAME
25+
- [ ] I have titled my PR with Region | Cohort | FirstName LastName | Sprint | Assignment Title
26+
- [ ] My changes meet the requirements of the task
2227
- [ ] I have tested my changes
23-
- [ ] My changes follow the [style guide](https://curriculum.codeyourfuture.io/guides/contributing/)
24-
- [ ] My changes meet the [requirements](./README.md) of this task
28+
- [ ] My changes follow the [style guide](https://curriculum.codeyourfuture.io/guides/reviewing/style-guide/)
2529

2630
## Changelist
2731

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Validate PR Metadata
2+
on:
3+
pull_request_target:
4+
types:
5+
- labeled
6+
- unlabeled
7+
- opened
8+
- edited
9+
- reopened
10+
11+
jobs:
12+
validate_pr_metadata:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
- uses: CodeYourFuture/actions/validate-pr-metadata@main
17+
with:
18+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
package-lock=false

HOW_TO_REVIEW.md

Lines changed: 0 additions & 52 deletions
This file was deleted.
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Implement solutions and rewrite tests with Jest
2+
3+
Before writing any code, please read the [Testing Function Guide](testing-guide.md) to learn how
4+
to choose test values that thoroughly test a function.
5+
6+
## 1 Implement solutions
7+
8+
In the `implement` directory you've got a number of functions you'll need to implement.
9+
For each function, you also have a number of different cases you'll need to check for your function.
10+
11+
Write your assertions and build up your program case by case. Don't rush to a solution. The point of these assignments is to learn how to write assertions and build up a program step by step.
12+
13+
Here is a recommended order:
14+
15+
1. `1-get-angle-type.js`
16+
2. `2-is-proper-fraction.js`
17+
3. `3-get-card-value.js`
18+
19+
## 2 Rewrite tests with Jest
20+
21+
`console.log` is most often used as a debugging tool. We use to inspect the state of our program during runtime.
22+
23+
We can use `console.assert` to write assertions: however, it is not very easy to use when writing large test suites. In the first section, Implement, we used a custom "helper function" to make our assertions more readable.
24+
25+
Jest is a whole library of helper functions we can use to make our assertions more readable and easier to write.
26+
27+
Your new task is to write the same tests as you wrote in the `implement` directory, but using Jest instead of `console.assert`.
28+
29+
You shouldn't have to change the contents of `implement` to write these tests.
30+
31+
There are files for your Jest tests in the `rewrite-tests-with-jest` directory. They will automatically use the functions you already implemented.
32+
33+
You can run all the tests in this repo by running `npm test` in your terminal. However, VSCode has a built-in test runner that you can use to run the tests, and this should make it much easier to focus on building up your test cases one at a time.
34+
35+
https://code.visualstudio.com/docs/editor/testing
36+
37+
1. Go to rewrite-tests-with-jest/1-get-angle-type.test.js
38+
2. Click the green play button to run the test. It's on the left of the test function in the gutter.
39+
3. Read the output in the TEST_RESULTS tab at the bottom of the screen.
40+
4. Explore all the tests in this repo by opening the TEST EXPLORER tab. The logo is a beaker.
41+
42+
![VSCode Test Runner](../../run-this-test.png)
43+
44+
![Test Results](../../test-results-output.png)
45+
46+
> [!TIP]
47+
> You can always run a single test file by running `npm test path/to/test-file.test.js`.
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// Implement a function getAngleType
2+
//
3+
// When given an angle in degrees, it should return a string indicating the type of angle:
4+
// - "Acute angle" for angles greater than 0° and less than 90°
5+
// - "Right angle" for exactly 90°
6+
// - "Obtuse angle" for angles greater than 90° and less than 180°
7+
// - "Straight angle" for exactly 180°
8+
// - "Reflex angle" for angles greater than 180° and less than 360°
9+
// - "Invalid angle" for angles outside the valid range.
10+
11+
// Assumption: The parameter is a valid number. (You do not need to handle non-numeric inputs.)
12+
13+
// Acceptance criteria:
14+
// After you have implemented the function, write tests to cover all the cases, and
15+
// execute the code to ensure all tests pass.
16+
17+
function getAngleType(angle) {
18+
// TODO: Implement this function
19+
}
20+
21+
// The line below allows us to load the getAngleType function into tests in other files.
22+
// This will be useful in the "rewrite tests with jest" step.
23+
module.exports = getAngleType;
24+
25+
// This helper function is written to make our assertions easier to read.
26+
// If the actual output matches the target output, the test will pass
27+
function assertEquals(actualOutput, targetOutput) {
28+
console.assert(
29+
actualOutput === targetOutput,
30+
`Expected ${actualOutput} to equal ${targetOutput}`
31+
);
32+
}
33+
34+
// TODO: Write tests to cover all cases, including boundary and invalid cases.
35+
// Example: Identify Right Angles
36+
const right = getAngleType(90);
37+
assertEquals(right, "Right angle");

0 commit comments

Comments
 (0)