Skip to content

Solved components #99

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

Open
wants to merge 120 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
120 commits
Select commit Hold shift + click to select a range
2b5f14c
Require Hello World in the document
acbart Jan 31, 2022
a7dee05
Rename text.Test.tsx to text.test.tsx
acbart Jan 31, 2022
3e381f3
Include the task info
acbart Jan 31, 2022
fee03d3
Merge branch 'task-first-branch' of https://github.com/UD-CISC275-S22…
acbart Jan 31, 2022
986b28a
First stab at questions
acbart Feb 2, 2022
e6b1dab
Allow one or more instances of the Hello World text
acbart Feb 3, 2022
2c852d6
Move Question interface to separate file
acbart Feb 6, 2022
dc3662a
Create answer interface
acbart Feb 8, 2022
51221ee
First stab at nested tasks
acbart Feb 8, 2022
3a793cc
Document Question interface
acbart Feb 9, 2022
5c39a97
Expand questions test data
acbart Feb 9, 2022
6ae0b6f
Add a little hint for a tough one
acbart Feb 9, 2022
b1bbbc8
Nested tests (phew)
acbart Feb 9, 2022
ab9bfb5
Basic starter files for components
acbart Feb 9, 2022
9765863
Another extra paren error
acbart Feb 9, 2022
d6c10cd
Merge branch 'main' of https://github.com/UD-CISC275-S22/react-typesc…
acbart Feb 13, 2022
c0bbc39
Updated, complete tests for all state components
acbart Feb 13, 2022
eb40f3e
Forgot task record for state
acbart Feb 19, 2022
6669ffa
First draft of components subtasks
acbart Feb 19, 2022
562f306
Another subtask, ChooseTeam
acbart Feb 24, 2022
4a34f5f
Oops order out of operations
acbart Feb 24, 2022
7327f4c
Add headers to each subtask
acbart Feb 24, 2022
cf7c212
Make testing easier for these components
acbart Feb 24, 2022
08feee1
Ugh this component is stupid, let's just forget about it for now
acbart Feb 24, 2022
89053a4
Provide the tests for the bad components
acbart Feb 24, 2022
7a20734
Include json test command here
acbart Aug 24, 2024
7fe9ca3
Require Hello World in the document
acbart Jan 31, 2022
b8b8878
Include the task info
acbart Jan 31, 2022
fbdebde
Rename text.Test.tsx to text.test.tsx
acbart Jan 31, 2022
2f0146c
Allow one or more instances of the Hello World text
acbart Feb 3, 2022
a6acb43
Merge branch 'task-first-branch' of https://github.com/frontend-fun/t…
acbart Aug 24, 2024
ac36b32
First set of tests
acbart Jan 30, 2022
d04739d
Some logging tests
acbart Jan 30, 2022
b26100f
More html tests
acbart Jan 30, 2022
3bf4550
Fix the image test
acbart Jan 30, 2022
8dff2b6
Updated CSS tests, left a note about additional tests
acbart Jan 31, 2022
b66d4de
See previous commit message
acbart Jan 31, 2022
0a24364
Add in new css test
acbart Aug 24, 2024
4d43d7a
Add in points
acbart Aug 24, 2024
83c4461
Basic functions tests and stubs
acbart Jan 30, 2022
a486530
Fix test organization
acbart Jan 30, 2022
9722564
Fix issue in fahrenheit conversion
acbart Jan 30, 2022
bd06d5d
Move around some of the functions
acbart Feb 3, 2022
4cd1900
Explain what the actual functions require you to do
acbart Feb 3, 2022
cf1d21a
Update formatting
acbart Aug 24, 2024
e11693a
Add in points
acbart Aug 24, 2024
7cc4e3f
First stab at array problems
acbart Feb 1, 2022
f253337
Add in the rest of the tests
acbart Feb 1, 2022
b8777b1
Fix question text
acbart Feb 1, 2022
f87771e
Update arrays.test.ts
acbart Feb 11, 2022
f0d316b
Add in points
acbart Aug 24, 2024
c2e556d
First stab at questions
acbart Feb 2, 2022
406ffb2
Move Question interface to separate file
acbart Feb 6, 2022
9b9adb6
Fix formatting
acbart Aug 24, 2024
3660252
First stab at questions
acbart Feb 2, 2022
09d3d4f
Move Question interface to separate file
acbart Feb 6, 2022
9a24024
Create answer interface
acbart Feb 8, 2022
879fe17
First stab at nested tasks
acbart Feb 8, 2022
4d29d21
Document Question interface
acbart Feb 9, 2022
d71d9fc
Expand questions test data
acbart Feb 9, 2022
c955718
Add a little hint for a tough one
acbart Feb 9, 2022
c574699
Nested tests (phew)
acbart Feb 9, 2022
a368ad0
Forgot the task record!
acbart Feb 19, 2022
304184e
Fix typo in editOption test, and missing return type for editOption
acbart Mar 1, 2022
1b76b80
Fix formatting
acbart Aug 24, 2024
23314f3
update point values for tests
acbart Aug 24, 2024
82faacc
Fix react return value
acbart Aug 24, 2024
cc7d4db
Update react tests to use async
acbart Aug 24, 2024
c419dc9
Fix linting
acbart Aug 24, 2024
444b03b
Merge branch 'task-state' into task-components
acbart Aug 24, 2024
c1aab28
Merge branch 'update-branches' into task-components
acbart Aug 24, 2024
50a9c85
Update for new react
acbart Aug 24, 2024
5247639
Merge branch 'main' into task-components
greglnelson Sep 8, 2024
67edb6d
Merge branch 'main' into task-nested
greglnelson Sep 8, 2024
5a7921b
Merge branch 'main' into task-objects
greglnelson Sep 8, 2024
80f1cf6
Update HtmlCss.test.tsx
greglnelson Sep 17, 2024
974fb09
Merge so 2024 works
greglnelson Oct 17, 2024
ae19e0f
reduced workload by half
greglnelson Oct 17, 2024
f2cd1ef
remove cycleholiday and startattempt
greglnelson Oct 26, 2024
f9ec33b
Merge branch 'task-nested' into task-state
greglnelson Oct 26, 2024
f4e8bec
Add missing function that was in a removed problem
greglnelson Oct 26, 2024
a179ca9
Remove removed problems from App.tsx
greglnelson Oct 26, 2024
e40378e
remove shovebox
greglnelson Oct 26, 2024
d9e6d0f
Merge so students dont have to, merge branch 'task-state' into task-c…
greglnelson Oct 26, 2024
0c840d7
fix a potential bug with toBeCalled, investigate more next year
greglnelson Oct 27, 2024
ff703b5
Update TwoDice.test.tsx
greglnelson Oct 31, 2024
73ef19c
remove old file that got in there accidentally and causes linting pro…
greglnelson Nov 4, 2024
111807e
Merge branch 'gh-task-state' into task-components
greglnelson Nov 4, 2024
b2ec4fa
Add back in files to match interactive textbook
TSchotter Mar 30, 2025
f5c02fa
Just making sure everythign works
RexTheMyth May 21, 2025
b4390bb
Merge remote-tracking branch 'upstream/task-first-branch' into solved…
RexTheMyth May 21, 2025
7321089
added Hello World
RexTheMyth May 21, 2025
3465ef2
Merge remote-tracking branch 'upstream/task-html-css' into solved-htm…
RexTheMyth May 21, 2025
c62d9ea
ya
RexTheMyth May 21, 2025
6dc7bc3
Took out test as I cant figure it out
RexTheMyth May 21, 2025
0e27280
Merge remote-tracking branch 'upstream/task-functions' into solved-fu…
RexTheMyth May 21, 2025
d240e45
it works
RexTheMyth May 22, 2025
d8d9bcd
Merge remote-tracking branch 'upstream/task-arrays' into solved-arrays
RexTheMyth May 22, 2025
7026c5b
arrays were fun
RexTheMyth May 22, 2025
f216927
Merge remote-tracking branch 'upstream/task-objects' into solved-objects
RexTheMyth May 22, 2025
20b66d0
First 3 Done
RexTheMyth May 22, 2025
de26cb6
id and Q name done
RexTheMyth May 22, 2025
2ea224d
that was painful
RexTheMyth May 22, 2025
89be9e4
That was easy
RexTheMyth May 22, 2025
dbe7624
Australian joke
RexTheMyth May 22, 2025
6e43bee
question didnt mention the ID change
RexTheMyth May 22, 2025
46bac83
options equals options.newoptions : options [options]:new.questions
RexTheMyth May 23, 2025
4547b5b
Merging two questions
RexTheMyth May 23, 2025
08bc499
Merge remote-tracking branch 'upstream/task-nested' into solved-nested
RexTheMyth May 23, 2025
bfdddc7
published quests done
RexTheMyth May 23, 2025
4fe29d2
oops, i forgot the commits
RexTheMyth May 24, 2025
05b3371
Merge remote-tracking branch 'upstream/task-state' into solved-state
RexTheMyth May 24, 2025
0336375
merge time
RexTheMyth May 24, 2025
0632a9d
life is 42
RexTheMyth May 24, 2025
140a42c
we changed the types
RexTheMyth May 24, 2025
c4395bb
Acting strange, resetting
RexTheMyth May 24, 2025
a7450b6
im cutting my loses
RexTheMyth May 24, 2025
e68ff9c
Merge remote-tracking branch 'upstream/task-components' into solved-c…
RexTheMyth May 24, 2025
1290949
teams chosen
RexTheMyth May 24, 2025
92167b4
no more doublehalfstate
RexTheMyth May 24, 2025
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
Empty file added git
Empty file.
123 changes: 57 additions & 66 deletions package-lock.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"build": "react-scripts build",
"test": "react-scripts test",
"test:cov": "react-scripts test --coverage --watchAll",
"test:json": "react-scripts test --json --watchAll=false --outputFile jest-output.json --coverage",
"eject": "react-scripts eject",
"lint": "eslint ./src --ext .tsx --ext .ts --max-warnings 0",
"eslint-output": "eslint-output ./src --ext .tsx --ext .ts --max-warnings 0",
Expand Down
5 changes: 5 additions & 0 deletions public/tasks/task-arrays.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Task - Arrays

Version: 0.0.1

Implement functions that work with arrays immutably.
5 changes: 5 additions & 0 deletions public/tasks/task-components.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Task - Components

Version: 0.0.1

Fix some components that are using state incorrectly.
5 changes: 5 additions & 0 deletions public/tasks/task-first-branch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Task - First Branch

Version: 0.0.1

Pass a short test to have certain text on the page.
5 changes: 5 additions & 0 deletions public/tasks/task-functions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Task - Functions

Version: 0.0.1

Implement a bunch of functions that work on primitives.
5 changes: 5 additions & 0 deletions public/tasks/task-html-css.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Task - HTML/CSS

Version: 0.0.1

Add in some HTML and CSS, including a fancy looking button.
5 changes: 5 additions & 0 deletions public/tasks/task-nested.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Task - Nested

Version: 0.0.1

Implement functions that work with nested arrays and objects immutably.
5 changes: 5 additions & 0 deletions public/tasks/task-objects.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Task - Objects

Version: 0.0.1

Implement functions that work with objects immutably.
5 changes: 5 additions & 0 deletions public/tasks/task-state.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Task - State

Version: 0.0.1

Create some new components that have React State.
39 changes: 35 additions & 4 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,47 @@
import React from "react";
import "./App.css";
import boat from "./Assets/Boat.jpg";
import { ChangeType } from "./components/ChangeType";
import { RevealAnswer } from "./components/RevealAnswer";
import { TwoDice } from "./components/TwoDice";
import { Counter } from "./components/Counter";
import { DoubleHalf } from "./bad-components/DoubleHalf";
import { ColoredBox } from "./bad-components/ColoredBox";
import { ChooseTeam } from "./bad-components/ChooseTeam";
import { StartAttempt } from "./components/StartAttempt";

function App(): React.JSX.Element {
return (
<div className="App">
<header className="App-header">
UM COS420 with React Hooks and TypeScript
</header>
<p>
Edit <code>src/App.tsx</code> and save. This page will
automatically reload.
</p>
<h1>This is a Heading</h1>
<img src={boat} alt="a picture of a boat" />
<button
onClick={() => {
console.log("Hello World!");
}}
>
Log Hello World
</button>
<hr></hr>
<DoubleHalf></DoubleHalf>
<hr></hr>
<ChooseTeam></ChooseTeam>
<hr></hr>
<ColoredBox></ColoredBox>
<hr></hr>
<Counter></Counter>
<hr />
<RevealAnswer></RevealAnswer>
<hr />
<StartAttempt></StartAttempt>
<hr />
<TwoDice></TwoDice>
<hr /> <span style={{ backgroundColor: "red" }}> Hello World </span>
Signed: Braden Pare
<ChangeType></ChangeType>
</div>
);
}
Expand Down
Binary file added src/Assets/Boat.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
273 changes: 273 additions & 0 deletions src/arrays.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,273 @@
import {
allRGB,
bookEndList,
countShortWords,
injectPositive,
makeMath,
removeDollars,
shoutIfExclaiming,
stringsToIntegers,
tripleNumbers,
} from "./arrays";

describe("Testing the array functions", () => {
//////////////////////////////////
// bookEndList and tripleNumbers

const NUMBERS_1 = [1, 2, 3];
const NUMBERS_2 = [100, 300, 200];
const NUMBERS_3 = [5];
const NUMBERS_4: number[] = [];
const NUMBERS_5 = [100, 199, 1, -5, 7, 3];
const NUMBERS_6 = [-100, -200, 100, 200];
const NUMBERS_7 = [199, 1, 550, 50, 200];

// Ensure that none of the arrays were changed mutably
// If you fail these, you aren't using map/filter/reduce/etc. properly!
afterEach(() => {
expect(NUMBERS_1).toEqual([1, 2, 3]);
expect(NUMBERS_2).toEqual([100, 300, 200]);
expect(NUMBERS_3).toEqual([5]);
expect(NUMBERS_4).toEqual([]);
expect(NUMBERS_5).toEqual([100, 199, 1, -5, 7, 3]);
expect(NUMBERS_6).toEqual([-100, -200, 100, 200]);
expect(NUMBERS_7).toEqual([199, 1, 550, 50, 200]);
});

test("(3 pts) Testing the bookEndList function", () => {
expect(bookEndList(NUMBERS_1)).toEqual([1, 3]);
expect(bookEndList(NUMBERS_2)).toEqual([100, 200]);
expect(bookEndList(NUMBERS_3)).toEqual([5, 5]);
expect(bookEndList(NUMBERS_4)).toEqual([]);
expect(bookEndList(NUMBERS_5)).toEqual([100, 3]);
expect(bookEndList(NUMBERS_6)).toEqual([-100, 200]);
});

test("(3 pts) Testing the tripleNumbers function", () => {
expect(tripleNumbers(NUMBERS_1)).toEqual([3, 6, 9]);
expect(tripleNumbers(NUMBERS_2)).toEqual([300, 900, 600]);
expect(tripleNumbers(NUMBERS_3)).toEqual([15]);
expect(tripleNumbers(NUMBERS_4)).toEqual([]);
expect(tripleNumbers(NUMBERS_5)).toEqual([300, 597, 3, -15, 21, 9]);
expect(tripleNumbers(NUMBERS_6)).toEqual([-300, -600, 300, 600]);
});

//////////////////////////////////
// stringsToIntegers

const VALUES_1 = ["1", "2", "3"];
const VALUES_2 = ["100", "200", "300"];
const VALUES_3 = ["5"];
const VALUES_4: string[] = [];
const VALUES_5 = ["100", "?", "27", "$44"];
const VALUES_6 = ["-1", "0", "1", "*1"];
const VALUES_7 = ["apple", "banana", "cactus"];

// Ensure that none of the arrays were changed mutably
// If you fail these, you aren't using map/filter/reduce/etc. properly!
afterEach(() => {
expect(VALUES_1).toEqual(["1", "2", "3"]);
expect(VALUES_2).toEqual(["100", "200", "300"]);
expect(VALUES_3).toEqual(["5"]);
expect(VALUES_4).toEqual([]);
expect(VALUES_5).toEqual(["100", "?", "27", "$44"]);
expect(VALUES_6).toEqual(["-1", "0", "1", "*1"]);
expect(VALUES_7).toEqual(["apple", "banana", "cactus"]);
});

test("(3 pts) Testing the stringsToIntegers function", () => {
expect(stringsToIntegers(VALUES_1)).toEqual([1, 2, 3]);
expect(stringsToIntegers(VALUES_2)).toEqual([100, 200, 300]);
expect(stringsToIntegers(VALUES_3)).toEqual([5]);
expect(stringsToIntegers(VALUES_4)).toEqual([]);
expect(stringsToIntegers(VALUES_5)).toEqual([100, 0, 27, 0]);
expect(stringsToIntegers(VALUES_6)).toEqual([-1, 0, 1, 0]);
expect(stringsToIntegers(VALUES_7)).toEqual([0, 0, 0]);
});

//////////////////////////////////
// removeDollars

const AMOUNTS_1 = ["$1", "$2", "$3"];
const AMOUNTS_2 = ["$100", "$200", "$300", "$400"];
const AMOUNTS_3 = ["$5"];
const AMOUNTS_4 = ["$"];
const AMOUNTS_5 = ["100", "200", "$300", "$400"];
const AMOUNTS_6: string[] = [];
const AMOUNTS_7 = ["100", "???", "7", "$233", "", "$"];
const AMOUNTS_8 = ["$one", "two", "$three"];

// Ensure that none of the arrays were changed mutably
// If you fail these, you aren't using map/filter/reduce/etc. properly!
afterEach(() => {
expect(AMOUNTS_1).toEqual(["$1", "$2", "$3"]);
expect(AMOUNTS_2).toEqual(["$100", "$200", "$300", "$400"]);
expect(AMOUNTS_3).toEqual(["$5"]);
expect(AMOUNTS_4).toEqual(["$"]);
expect(AMOUNTS_5).toEqual(["100", "200", "$300", "$400"]);
expect(AMOUNTS_6).toEqual([]);
expect(AMOUNTS_7).toEqual(["100", "???", "7", "$233", "", "$"]);
expect(AMOUNTS_8).toEqual(["$one", "two", "$three"]);
});

test("(3 pts) Testing the removeDollars function", () => {
expect(removeDollars(AMOUNTS_1)).toEqual([1, 2, 3]);
expect(removeDollars(AMOUNTS_2)).toEqual([100, 200, 300, 400]);
expect(removeDollars(AMOUNTS_3)).toEqual([5]);
expect(removeDollars(AMOUNTS_4)).toEqual([0]);
expect(removeDollars(AMOUNTS_5)).toEqual([100, 200, 300, 400]);
expect(removeDollars(AMOUNTS_6)).toEqual([]);
expect(removeDollars(AMOUNTS_7)).toEqual([100, 0, 7, 233, 0, 0]);
expect(removeDollars(AMOUNTS_8)).toEqual([0, 0, 0]);
});

//////////////////////////////////
// shoutIfExclaiming

const MESSAGE_1 = ["Hello", "you", "are", "great!"];
const MESSAGE_2 = ["oho!", "Oho!", "oHo!", "oHO!", "OHO!"];
const MESSAGE_3 = ["Wait?", "What?", "Lo", "How?", "High!"];
const MESSAGE_4 = ["??????"];
const MESSAGE_5: string[] = ["This one is very long!"];
const MESSAGE_6 = ["No", "Caps", "here.", "Right?"];

// Ensure that none of the arrays were changed mutably
// If you fail these, you aren't using map/filter/reduce/etc. properly!
afterEach(() => {
expect(MESSAGE_1).toEqual(["Hello", "you", "are", "great!"]);
expect(MESSAGE_2).toEqual(["oho!", "Oho!", "oHo!", "oHO!", "OHO!"]);
expect(MESSAGE_3).toEqual(["Wait?", "What?", "Lo", "How?", "High!"]);
expect(MESSAGE_4).toEqual(["??????"]);
expect(MESSAGE_5).toEqual(["This one is very long!"]);
expect(MESSAGE_6).toEqual(["No", "Caps", "here.", "Right?"]);
});

test("(3 pts) Testing the shoutIfExclaiming function", () => {
expect(shoutIfExclaiming(MESSAGE_1)).toEqual([
"Hello",
"you",
"are",
"GREAT!",
]);
expect(shoutIfExclaiming(MESSAGE_2)).toEqual([
"OHO!",
"OHO!",
"OHO!",
"OHO!",
"OHO!",
]);
expect(shoutIfExclaiming(MESSAGE_3)).toEqual(["Lo", "HIGH!"]);
expect(shoutIfExclaiming(MESSAGE_4)).toEqual([]);
expect(shoutIfExclaiming(MESSAGE_5)).toEqual([
"THIS ONE IS VERY LONG!",
]);
expect(shoutIfExclaiming(MESSAGE_6)).toEqual(["No", "Caps", "here."]);
});

//////////////////////////////////
// countShortWords

const WORDS_1 = ["the", "cat", "in", "the", "hat"];
const WORDS_2 = ["one", "two", "three", "four", "five", "six", "seven"];
const WORDS_3 = ["alpha", "beta", "gamma"];
const WORDS_4 = ["Longest", "Words", "Possible"];
const WORDS_5: string[] = [];
const WORDS_6 = ["", "", "", ""];

// Ensure that none of the arrays were changed mutably
// If you fail these, you aren't using map/filter/reduce/etc. properly!
afterEach(() => {
expect(WORDS_1).toEqual(["the", "cat", "in", "the", "hat"]);
expect(WORDS_2).toEqual([
"one",
"two",
"three",
"four",
"five",
"six",
"seven",
]);
expect(WORDS_3).toEqual(["alpha", "beta", "gamma"]);
expect(WORDS_4).toEqual(["Longest", "Words", "Possible"]);
expect(WORDS_5).toEqual([]);
expect(WORDS_6).toEqual(["", "", "", ""]);
});

test("(3 pts) Testing the countShortWords function", () => {
expect(countShortWords(WORDS_1)).toEqual(5);
expect(countShortWords(WORDS_2)).toEqual(3);
expect(countShortWords(WORDS_3)).toEqual(0);
expect(countShortWords(WORDS_4)).toEqual(0);
expect(countShortWords(WORDS_5)).toEqual(0);
expect(countShortWords(WORDS_6)).toEqual(4);
});

//////////////////////////////////
// allRGB

const COLORS_1 = ["red", "green", "blue"];
const COLORS_2 = ["red", "red", "red"];
const COLORS_3 = ["red", "red", "blue", "blue", "green", "red"];
const COLORS_4 = ["purple", "orange", "violet"];
const COLORS_5 = ["red", "blue", "yellow"];
const COLORS_6 = ["green"];
const COLORS_7 = ["red"];
const COLORS_8 = ["kabluey"];
const COLORS_9: string[] = [];

// Ensure that none of the arrays were changed mutably
// If you fail these, you aren't using map/filter/reduce/etc. properly!
afterEach(() => {
expect(COLORS_1).toEqual(["red", "green", "blue"]);
expect(COLORS_2).toEqual(["red", "red", "red"]);
expect(COLORS_3).toEqual([
"red",
"red",
"blue",
"blue",
"green",
"red",
]);
expect(COLORS_4).toEqual(["purple", "orange", "violet"]);
expect(COLORS_5).toEqual(["red", "blue", "yellow"]);
expect(COLORS_6).toEqual(["green"]);
expect(COLORS_7).toEqual(["red"]);
expect(COLORS_8).toEqual(["kabluey"]);
expect(COLORS_9).toEqual([]);
});

test("(3 pts) Testing the allRGB function", () => {
expect(allRGB(COLORS_1)).toEqual(true);
expect(allRGB(COLORS_2)).toEqual(true);
expect(allRGB(COLORS_3)).toEqual(true);
expect(allRGB(COLORS_4)).toEqual(false);
expect(allRGB(COLORS_5)).toEqual(false);
expect(allRGB(COLORS_6)).toEqual(true);
expect(allRGB(COLORS_7)).toEqual(true);
expect(allRGB(COLORS_8)).toEqual(false);
expect(allRGB(COLORS_9)).toEqual(true);
});

//////////////////////////////////
// makeMath

test("(3 pts) Testing the makeMath function", () => {
expect(makeMath(NUMBERS_1)).toEqual("6=1+2+3");
expect(makeMath(NUMBERS_2)).toEqual("600=100+300+200");
expect(makeMath(NUMBERS_3)).toEqual("5=5");
expect(makeMath(NUMBERS_4)).toEqual("0=0");
expect(makeMath(NUMBERS_7)).toEqual("1000=199+1+550+50+200");
});

//////////////////////////////////
// injectPositive
test("(3 pts) Testing the injectPositive function", () => {
expect(injectPositive(NUMBERS_1)).toEqual([1, 2, 3, 6]);
expect(injectPositive(NUMBERS_2)).toEqual([100, 300, 200, 600]);
expect(injectPositive(NUMBERS_3)).toEqual([5, 5]);
expect(injectPositive(NUMBERS_4)).toEqual([0]);
expect(injectPositive(NUMBERS_5)).toEqual([100, 199, 1, -5, 300, 7, 3]);
expect(injectPositive(NUMBERS_6)).toEqual([-100, 0, -200, 100, 200]);
expect(injectPositive(NUMBERS_7)).toEqual([199, 1, 550, 50, 200, 1000]);
});
});
Loading