assignments's People
Forkers
shaarifg raj-gigt ron2111 vishalsingh2972 bigyanpatel abhishekvarma12345 saishankar93 naviava hg8116 helloshiv benedicti0n nishaaaanth vynktesh raj2raaz kausshik iakshatgandhi imrityunjaykr keniljoshi syerabat ameeetgaikwad priteshdube shantanugaur26 janardannn koder-aritra nishantgupt786 guptaachyut15 amanvc usaketh harsh32044 ameya-6964 areyannnnn gptsahil idrag0 mehsumnaqvi whynesspower umeraghori vishal2002 raman0925 vaibhav2396 100xdevswithharkirat jatin4224 rahmatdeep muneebnazir birendrabohara1230 gokula77 ar-waz aashishx03 mohdsaquib114 sanjai0py vatsalbhesaniya nehanihar12 sainiaditya1 pritam12f shreeup rituraj-13 theparthmaru nagxsan gyaneshwerjha deepsalunkhee meetjn techypants shaurya19 khushi-pandey sathish111j meghshyam11 et-mohan aditya1876 vaahwan prayagchhabra bkm14 adityarajthakur akshitlakhera 2000ilyaz2000 03brainy-clicks adityathapa virajp4 scurlly chandankumar166 0x1zen ak4266 jaskarankaur aniketsinha5552 veer-07 100rabhsah daveprayag dhruvalpatel calm1111 13yadav adoshsingh gokulkrish10 yeshwantthota harsha1varthan subhasish-roy akshaydoshi2 sandeepbhartiya hyphen-amit krunaldarekar abananyabera vineeth543 harshit118gargassignments's Issues
Enable adding labels in the PR
Tests incorrect for anagram js
incomplete code of 01-Class.js
Week 3 - Missing `express` dependency in `03-mongo` package.json
A regular npm install
does not install express and a separate install is required using npm install express
.
Need to simplify the assignment setup for students as the assignment relies heavily on express package.
Dependency Array Issue in useMemo in `Assignment2` Component
Title: Dependency Array Issue in useMemo in Assignment2
Component
Description:
I noticed an issue in the Assignment2 component where the sentences
array is included in the dependency array for useMemo
. Since the sentences
array is not updated anywhere in the code, it should not be part of the dependency array.
Current Code:
const filteredSentences = useMemo(() => {
return sentences.filter(x => x.includes(filter));
}, [sentences, filter]);
Suggested Correction:
const filteredSentences = useMemo(() => {
return ALL_WORDS.filter(x => x.includes(filter));
}, [filter]);
W03: Middleware TestCase - done callback not passed to function argument
optimise bodyParser in week-02/03-mongo
it took a lot of time to figure out that when you include postman body and even if you comment it out the global middleware app.use(bodyaParser.json()) will try to parse and throw an error so set body to none or it should have nothig (not even commented something) while sending get requests or try to set bodyParser middleware after get routes. @hkirat is there any way to exclude a particular ruote from a global middleware
Join() function not explained.
I think join() function which converts array into string is very important and should be included.If no one done it already allow mw to do it.
db.test.ts contain some errors ! Cant test the app !
wrong import statements in 1-use-memo in week 6
import { Assignment1 } from './components/Assignment2'
import { Assignment2 } from './components/Assignment1'
// wrong imports in 1-use-memo/app.jsx
Issue while setting up in Windows.
Test file for times.js is not found
Typo fixes
There are few typo fixes in few of the README.md files for few of the week assignments
Fixed division test case for Calculator.js
JavaScript doesn't throw a regular error for division by zero, and instead returns Infinity or -Infinity, we need to adjust the test accordingly.
In this modification, the test checks if the result of the division by zero is equal to Infinity. This aligns with the behavior of JavaScript when dividing a number by zero.
Test Case Issue week-2/01-async-js/tests/3-promise-all.test.js and 4- promise-chain
problem in the tsconfig.json
i was doing the jwt assignment
and I opened the tsconfig.json file in vscode.
i don't know if it's an error or not but vscode was showing this error message
No inputs were found in config file '/Users/sparshkarna/DevOps/assignments/week-3/02-jwt/tsconfig.json'. Specified 'include' paths were '["**/*"]' and 'exclude' paths were '[]'.
Assignment 01-js completed
Solved all the questions of Assignment 01-js:
Easy:
- Anagram
- Expenditure Analysis
- Find Largest Element
Medium:
- Count Vowels
- Palindrome
- Times
Hard:
- Calculator
- Todo List
Fix Test Case for Calculator.js
By just checking if the expression contains /0
you could bypass test case for division by zero , which shouldn't' be the case because expression such as 10/(2-2)
could also lead to division by zero.
Issue in solution of week-3/04-mongo-with-jwt-auth assignment
week-3/04-mongo-with-jwt-auth/solution/middleware/admin.js
week-3/04-mongo-with-jwt-auth/solution/middleware/admin.js
In both the above mentioned files, the middleware just checks if the token is valid or not. However, it does not distinguish whether the token sent corresponds to a user or an admin. Consequently, a user can potentially access admin features by providing their token, and vice versa.
After token verification, the middleware should additionally validate whether the associated username belongs to an admin. If not, it should send an authentication failed error.
Fixed the issue in 1-promisify-setTimeout.test.js
Test cases of 1-promisify-setTimeout.test.js are not working because of async.
Used chatpgt to fix the test cases and now my code is working fine. To see the conversation with chatgpt click this link
This is the updated test file code👇️ please review it
const wait = require("../hard (promises)/1-promisify-setTimeout");
describe("wait function", () => {
test("resolves after 1 second", async () => {
const start = Date.now();
await expect(wait(1000))
.resolves.toBeUndefined(); // Wait for 1 second
const end = Date.now();
const difference = end - start;
expect(difference).toBeGreaterThanOrEqual(1000); // Expect difference to be at least 1000 ms (1 second)
}, 2000); // Set timeout to 2000 ms (2 seconds)
test("resolves after 2 seconds", async () => {
const start = Date.now();
await expect(wait(2000))
.resolves.toBeUndefined(); // Wait for 2 seconds
const end = Date.now();
const difference = end - start;
expect(difference).toBeGreaterThanOrEqual(2000); // Expect difference to be at least 2000 ms (2 seconds)
}, 3000); // Set timeout to 3000 ms (3 seconds)
test("resolves after 3 seconds", async () => {
const start = Date.now();
await expect(wait(3000))
.resolves.toBeUndefined(); // Wait for 3 seconds
const end = Date.now();
const difference = end - start;
expect(difference).toBeGreaterThanOrEqual(3000); // Expect difference to be at least 3000 ms (3 seconds)
}, 4000); // Set timeout to 4000 ms (4 seconds)
});
correct decoding in decodeJwt test cases
Missing tests for week 3 mongodb and mongodb wih jwt assingments
the test cases for mongodb and mongodb with jwt assignments from week 3 are missing.
Unable to execute pull request
Github: When I created a pull request, I get:
Choose different branches or forks above to discuss and review changes. Learn about pull requests. I am unable execute a pull request. How to fix it?
reduce() function example is missing
Reduce() function is missing from array.js in week1\offline-class-1 folder.
Correction of countVowels Function Test Cases
Issue Description:
The existing test cases for the countVowels function have inconsistencies and inaccuracies in their expected outputs. These issues impact the accuracy and reliability of the function. Here are the identified problems in the test cases along with proposed fixes:
Inaccurate Counting:
- Existing Behavior: The test cases for specific strings ('programming', 'OpenAI', 'chatbot', 'EaSiEr') produce incorrect counts for vowels.
- Proposed Fix: Update the test cases to ensure the correct count of vowels is verified in these strings.
Steps to test:
In /01-js/tests/
directory run npx jest countVowels.test.js
.
Issue in anagram test case
The existing test cases for the anagram function have inaccuracies in their expected output.
Existing Behaviour: The test case is set to true for the inputs of ('rail safety', 'fairy tales')
Solution : It should be set to false as they are not anagrams
In /01-js/tests/ directory run npx jest anagram.test.js .
Week 3 - Bugs in Routes for Mongo Assignment
Bugs
app
not defined inroutes/admin.js
androutes/user.js
router
unused inroutes/admin.js
androutes/user.js
router
export missing fromroutes/user.js
week 10 test folder showing missing types, can't even run anything, nor can't compile the ts files into js files
setup issue in mac m1 machine
Hi @hkirat,
I found following issue while running node for the first time in my mac m1 box.
**root ~/self_help/js_practice/assignments [master] $ npm install
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path /Users/jee/self_help/js_practice/assignments/package.json
npm ERR! errno -2
npm ERR! enoent ENOENT: no such file or directory, open '/Users/jee/self_help/js_practice/assignments/package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in: /Users/jee/.npm/_logs/2023-12-04T07_16_37_623Z-debug-0.log**
==> I was getting the above issue in my mac box and ran "npm init -y" to create package.json. Is it a right way to do that ?
==> But still I was facing some issue while running test. I think it was because I didnt have "jest" installed on my system.
==> Can u plz put some light on this issue ?
Week3 02-jwt function comment description inaccurate
Small thing but in week-3/02-jwt/index.js
the comment description for decodeJwt
indicates the function is supposed to return an object or false
. This is innacurate because based on the tests, the function is actually supposed to return true or false
. Raising this since even though its a small issue, it can throw off students.
week-3 > 03-mongo > Readme.md | missing purchased property in Schema
ISSUE:
In the POST route while registering the user, it is not specified that the user should have a third property as purchased of type array. As the user purchases the course, it should have a purchased property set while signing up where all the purchases would be saved.
User Routes
GET: /users/purchasedCourses
Description: Lists all the courses purchased by the user. Input: Headers: { 'username': 'username', 'password': 'password' } Output: { purchasedCourses: [ { id: 1, title: 'course title', description: 'course description', price: 100, imageLink: 'https://linktoimage.com/', published: true }, ... ] }
POST: /users/signup
Description: Creates a new user account. Input: { username: 'user', password: 'pass' } Output: { message: 'User created successfully' }
SOLUTION:
USER SCHEMA should be:
const UserSchema = new mongoose.Schema({
// Schema definition here
username: String,
password: String,
purchased: Array,
});
&&
POST: /users/signup
Description: Creates a new user account. Input: { username: 'user', password: 'pass' }
newUser = {
username: req.headers.username,
password: req.headers.password,
purchased: [],
}
Output: { message: 'User created successfully' }
just tagging for reference
please upload the week 5 assigments
please upload the week 5 assigments
the import statements are misspelled
Test for Week-3/02-jwt behaving different than expected
Rename O5-Object.js
Rename the file name:
O5-Object.js to 05-Object.js
see the pull request #236
Test file missing for times.js
Testing suite is missing for the file medium/times.js file. Add a testing suite for the file.
Update documentation as test is expecting Boolean
Update response as the test expects Boolean (true) once the decode is successful rather than the payload object.
Up for discussion, if we need to update the test to expect the payload.
unsed-var eslint error
Hey sir Can use "un-used-variables": false, to off the unused error caused by eslint rc file
add a side popup bar in the video content
During watching the video content when i am spiliting the screen the video becomes small due to the side popup bar if you could implement the youtube like feature where when not required we can close the side popup bar
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.