Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
Crusader727 committed Feb 12, 2022
1 parent 4e773b0 commit ae5e03a
Show file tree
Hide file tree
Showing 8 changed files with 208 additions and 1 deletion.
28 changes: 28 additions & 0 deletions .github/workflows/nodejs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Labs Test

on: push

jobs:
lab3:
runs-on: ubuntu-16.04
name: Lab №3
steps:
- uses: actions/checkout@v2
- name: Setup node
uses: actions/setup-node@v1
with:
node-version: 10
- run: npm install
- run: npm run test-lab-3
lab4:
runs-on: ubuntu-16.04
needs: [lab3]
name: Lab №4
steps:
- uses: actions/checkout@v2
- name: Setup node
uses: actions/setup-node@v1
with:
node-version: 10
- run: npm install
- run: npm run test-lab-4
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
.node_modules
28 changes: 27 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,27 @@
# IU5-Frontend-2022
# Ссылка на ведомость:
https://docs.google.com/spreadsheets/d/1tI8__eRI9CBqyhxoyPkDUAurpd6_ZULPNyoh3VOmoTg/edit?usp=sharing

# Флоу работы с git
1. Делаем fork репозитория
2. Клоним свой репозиторий
3. Отводим ветку с названием лабораторной работы (git checkout -b lab1)
4. Выполняем задачу в папке созданной под лабу с соответствующим номером
5. Делаем коммит
git add .
git commit -m 'выполнил первую работу'
git push
6. Создаем Pull Request из вашей ветки с лабой в main
7. Заполняем форму отчетности по соответствующей лабе

# Флоу работы с проектом
1. Устанавливаем node
2. Устанавливаем зависимости npm i
3. Запускаем проект npm run start
4. Проект разворачивается на localhost на 8000 порте

# Флоу работы с задачами по JS
1. Устанавливаем node
2. Устанавливаем зависимости npm i
3. Можно запустить тесты локально - npm run test-lab-3
4. Все тесты должны быть зелененькие, иначе выведет в консоль ошибки

16 changes: 16 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>

<body style="margin: 40px">
<a href="./lab1/">Лабораторная #1</a>
<br>
</body>

</html>
51 changes: 51 additions & 0 deletions lab1/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/10.6.0/styles/default.min.css">
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/10.6.0/highlight.min.js"></script>
</head>

<body>
<!-- <pre>
<code id="code1" class="language-js"></code>
</pre>
<pre>
<code id="code2" class="language-js"></code>
</pre>
<pre>
<code id="code3" class="language-js"></code>
</pre>
<pre>
<code id="code4" class="language-js"></code>
</pre>
<pre>
<code id="code5" class="language-js"></code>
</pre>
<script>
function uploadFile(name, id) {
fetch(name).then(function(response) {
response.text().then(function(text) {
document.getElementById(id).innerHTML = text;
setTimeout(() => hljs.highlightAll(), 0);
});
});
}
function load() {
uploadFile('./1.js', 'code1');
uploadFile('./2.js', 'code2');
uploadFile('./3.js', 'code3');
uploadFile('./4.js', 'code4');
uploadFile('./5.js', 'code5');
}
window.onLoad = load();
</script> -->
</body>

</html>
23 changes: 23 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"name": "y",
"version": "1.0.0",
"description": "",
"workspaces": [
"./"
],
"dependencies": {
"express": "^4.17.1"
},
"devDependencies": {
"jest": "^26.6.3"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node server.js",
"test-lab-3": "jest lab3.test.js",
"test-lab-4": "jest lab4.test.js",
"test-lab-5": "jest lab5.test.js"
},
"author": "",
"license": "ISC"
}
8 changes: 8 additions & 0 deletions server.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
const express = require("express");

const app = express();
app.use("/", express.static(__dirname));

app.listen(process.env.PORT || "8000", () => {
console.log("Port: 8000");
});
53 changes: 53 additions & 0 deletions tests/lab3.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
const capitalize = require('../lab3/1.js');
const getMinMax = require('../lab3/2.js');
const multiplyArray = require('../lab3/3.js');
const prettySum = require('../lab3/4.js');

test('capitalize 1', () => {
expect(capitalize('я вижу солнце')).toBe('Я Вижу Солнце');
});

test('capitalize 2', () => {
expect(capitalize('я Вижу солнце')).toBe('Я Вижу Солнце');
});

test('capitalize 3', () => {
expect(capitalize('Я Вижу Солнце')).toBe('Я Вижу Солнце');
});

test('getMinMax 1', () => {
expect(getMinMax('4 и -6, 2, 1, может 9, 63, -134 и 566]')).toEqual({ min: -134, max: 566 });
});

test('getMinMax 2', () => {
expect(getMinMax('-2.5 ddd 1 nfuey 222.345 w 0')).toEqual({ min: -2.5, max: 222.345 });
});

test('multiplyArray 1', () => {
expect(multiplyArray([1, 2, 3, 'ddd', { min: 1 }, 22, false], 2)).toEqual([2, 4, 6, 'ddd', { min: 1 }, 44, false]);
});

test('multiplyArray 2', () => {
expect(multiplyArray([false, false], 2)).toEqual([false, false]);
});

test('multiplyArray 3', () => {
expect(multiplyArray([false, false, 2, 3], 2)).toEqual([false, false, 4, 6]);
});


test('prettySum 1', () => {
expect(prettySum([1, 2, 3, 4, 5, 6, 7, 8, 9, 10])).toBe(250);
});

test('prettySum 2', () => {
expect(prettySum([0, 0, 0, 4, 4, 4])).toBe(16);
});

test('prettySum 3', () => {
expect(prettySum([-5, 15, 32, -1, 0])).toBe(0);
});

test('prettySum 4', () => {
expect(prettySum([-4, -1, 3, 5])).toBe(-5);
});

0 comments on commit ae5e03a

Please sign in to comment.