forked from namastedev/namaste-frontend-system-design
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/namastedev/namaste-fronte…
- Loading branch information
Showing
6 changed files
with
7,832 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
const users = [ | ||
{ | ||
name: "Simran", | ||
age: 30, | ||
}, | ||
{ | ||
name: "Akshay", | ||
age: 28, | ||
}, | ||
{ | ||
name: "Sachin", | ||
age: 50, | ||
}, | ||
{ | ||
name: "Elon", | ||
age: 8, | ||
}, | ||
]; | ||
|
||
function sortingByAge() { | ||
const data = users.sort((a, b) => a.age - b.age); | ||
return data; | ||
} | ||
|
||
console.log(sortingByAge()); | ||
|
||
module.exports = sortingByAge; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
const sortingByAge = require("./app"); | ||
|
||
test("testing if the first user is Elon after sorting", () => { | ||
const sortedData = sortingByAge(); | ||
|
||
expect(sortedData[0].name).toBe("Elon"); | ||
}); | ||
|
||
test("testing if the sorted data has length of 4", () => { | ||
const sortedData = sortingByAge(); | ||
|
||
expect(sortedData).toHaveLength(4); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
const puppeteer = require("puppeteer"); | ||
|
||
(async () => { | ||
const browser = await puppeteer.launch({ | ||
headless: false, | ||
slowMo: 100, | ||
args: ["--window-size=1920,1080"], | ||
}); | ||
|
||
const page = await browser.newPage(); | ||
|
||
await page.goto("https://amazon.com"); | ||
|
||
console.log("Webpage Loaded"); | ||
|
||
await page.setViewport({ width: 1620, height: 1080 }); | ||
|
||
const coursesPageLink = ".menu > li:nth-child(3) > a"; | ||
|
||
await page.waitForSelector(coursesPageLink); | ||
|
||
await page.click(coursesPageLink); | ||
|
||
console.log("Courses Page Loaded"); | ||
|
||
const enrollButton = ".bg-success-btn"; | ||
await page.waitForSelector(enrollButton); | ||
|
||
await page.click(enrollButton); | ||
|
||
console.log("Namaste FSD page loaded"); | ||
|
||
// await browser.close(); | ||
})(); | ||
|
||
// HomeWork: | ||
// Automate whole user journey | ||
// Run this sript everyday at 08:00 AM - CRON job | ||
// Collect all the logs and erorrs send it to email - Amazon SES |
Oops, something went wrong.