Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
benspector-mls committed Jan 31, 2024
0 parents commit c889874
Show file tree
Hide file tree
Showing 30 changed files with 9,881 additions and 0 deletions.
33 changes: 33 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
module.exports = {
env: {
browser: true,
es2021: true,
jest: true,
},
extends: 'airbnb-base',
overrides: [
],
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
},
rules: {
'no-constant-condition': 'off',
'no-console': 'off',
'object-curly-newline': 'off',
'no-plusplus': 'off',
'no-promise-executor-return': 'off',
'func-style': 2,
'arrow-body-style': 'off',
'no-continue': 'off',
quotes: ['error', 'single', { allowTemplateLiterals: true, avoidEscape: true }],
'consistent-return': 'off',
'no-restricted-syntax': 'off',
'no-alert': 'off',
'no-unused-expressions': ['error', { allowTernary: true }],
'no-unused-vars': ['error', { argsIgnorePattern: '_', destructuredArrayIgnorePattern: '^_' }],
'no-confusing-arrow': 'off',
'max-classes-per-file': 'off',
'no-param-reassign': 'off',
},
};
Empty file added .github/.keep
Empty file.
14 changes: 14 additions & 0 deletions .github/classroom/autograding.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"tests": [
{
"name": "basic",
"setup": "npm install",
"run": "npm test",
"input": "",
"output": "",
"comparison": "included",
"timeout": 10,
"points": null
}
]
}
19 changes: 19 additions & 0 deletions .github/workflows/classroom.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: GitHub Classroom Workflow

on:
- push
- workflow_dispatch

permissions:
checks: write
actions: read
contents: read

jobs:
build:
name: Autograding
runs-on: ubuntu-latest
if: github.actor != 'github-classroom[bot]'
steps:
- uses: actions/checkout@v4
- uses: education/autograding@v1
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# node gitignore
node_modules/
coverage/
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 The Marcy Lab School

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
98 changes: 98 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
# Object Oriented Programming Assessment

- [Object Oriented Programming Assessment](#object-oriented-programming-assessment)
- [Before you start](#before-you-start)
- [That's a lot of tests](#thats-a-lot-of-tests)
- [Running tests effectively](#running-tests-effectively)
- [What resources can you use?](#what-resources-can-you-use)
- [Section 1: From Scratch](#section-1-from-scratch)
- ["Why can't I see my logs in the test?"](#why-cant-i-see-my-logs-in-the-test)
- [Section 2: Short Answer](#section-2-short-answer)
- [Section 3: Design Challenge](#section-3-design-challenge)


> Welcome to your Object Oriented Programming Assessment! This is a tougher assessment than last time, but you know what's also tougher? You. You can do this, because all you have to do is your best.
**Let's get started!**

Remember to `npm i` to install dependencies.

## What resources can you use?

This is an open book assessment which means you can use your notes and Google. However, please do not talk to other fellows and do not use any AI resources. We need to see what *you* know from this assessment.

Honestly the study guide might be the only thing you need, *definitely* use it.

## Before you start

Before you are 3 sections:
- Short Answers
- From Scratch
- Design Challenge

It's recommended that before you do anything, take a deep breath and let that useless adrenaline run out of you. Seriously, do that. **Do it.**

Ok, now that you're chill(er), it's time to start thinking about the assessment. It's always recommended that you **scan over the entire thing before starting** to code. This will let you see where you might run into big roadblocks or have speed boosts. This will help you plan your time more effectively.

## That's a lot of tests
You're about to see more tests than you ever have before. Do not panic. Test files are often a few hundred lines due to their repetitive nature. Sure the *file* is 200 lines long, but each isolated test is only a 2-10 lines long. Just like you've seen *a million* times now.

How do you rock an assessment? One test at a time. Work small, test often, keep moving forward.

## Running tests effectively

> Did you run `npm i` yet?
The prompts are super lightweight because you *need* to be reading the tests. We recommend using `npm run test:w`. This will activate jest's "watch" mode, which automatically re-runs the tests on every file save.

Remember, while in watch mode if you hit `w`, a menu of options opens. These options allow you to focus on only running certain test or certain test files.

For example hitting `p` and then typing `from-scratch` it will only run tests from a file that matches that name. You can hit `a` to go back to running all tests.

Hit `ctrl` and `c` to exit watch mode.

You go this!

# Section 1: Short Responses

Do them first! They are half of your assessment and should take far less time than the coding portion. They will also get your brain in the right space to begin programming.

If you are unsure about an answer, **Check the study guide or Google it and then put it into your own words**!

Some questions can be answered in a sentence. Answer your questions like you were trying to explain the concept to a confused classmate. Mind your grammar and use the correct technical jargon!

# Section 2: From Scratch
Inside the `from-scratch.js` file you'll see 3 things:

- `bankAccountFactory`
- A `Phone` class
- An `AppleIPhone` class

Your mission is to get all the tests to pass. There are a *lot* of tests and they'll tell you exactly what to build. Here are some tips for reading tests to write code:

- Read the test names! Those say what the test is looking for in plain english.
- What are the function signatures (what arguments do you need and what types of data do they expect)?
- Are the methods pure or do they rely on some internal state? Do they have side effects?
- Does the function console log? Return something? Both? Neither?? WHAT DOES IT DO?!
- Are your methods and properties *spelled* correctly?
- Do any classes inherit from any others?

## "Why can't I see my logs in the test?"
Because we are testing how and when you use `console.log`, we are "mocking it" — we are taking control of it and changing its behavior.

So, `console.log` what you need to in order to pass the test; but if you want to see some extra debugging output, use `console.info` instead since we haven't overwritten that function.

OR! Just use the `playground.js` file to mess around, that will log everything like normal. Run that file with `node playground.js`.

# Section 3: Design Challenge
This is the *most* fun part of the assignment. You have 2 classes `ToDoList` (in `ToDoList.js`) and `ToDoItem` (in, you guessed it, `ToDoItem.js`). **Your task is to create the basic properties and methods required for the relationship to work**.

The tests for these files are in `design-challenge.spec.js`. However, there's another part: **you must add your own methods and properties.**

**You must add at least 1 instance method and property to each class.** But feel free to add more! 1 each is just what the tests require.
* In order to keep the primary tests passing, make sure that your custom properties come *after* the required parameters (if at all).
* Run your tests constantly to make sure you don't accidentally break anything, ok?

To be nice, we've kick started the code a little bit with an ID utils function.

_**Now get out there and good luck!**_
11 changes: 11 additions & 0 deletions hooks/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/sh

npm run test

git add scores/scores.json

# What's this file?
# It's called a "git hook" and it "hooks" into certain git actions
# In this case, it's a pre-commit hook, which runs before you commit
# And we're using it to run the test command, which will ensure the test suite
# scores have been calculated
7 changes: 7 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/** @type {import('jest').Config} */
const config = {
verbose: true,
modulePathIgnorePatterns: ['<rootDir>/scores/'],
};

module.exports = config;
Loading

0 comments on commit c889874

Please sign in to comment.