Skip to content

Commit

Permalink
Database integration (#93)
Browse files Browse the repository at this point in the history
Co-authored-by: Semyon Okulov <[email protected]>
Co-authored-by: Semyon Okulov <[email protected]>
  • Loading branch information
3 people authored Jan 1, 2024
1 parent 59a6604 commit 95ca04a
Show file tree
Hide file tree
Showing 95 changed files with 1,429 additions and 3,892 deletions.
1 change: 0 additions & 1 deletion .eslintignore

This file was deleted.

32 changes: 0 additions & 32 deletions .eslintrc.cjs

This file was deleted.

6 changes: 3 additions & 3 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

version: 2
updates:
- package-ecosystem: "" # See documentation for possible values
directory: "/frontend" # Location of package manifests
- package-ecosystem: '' # See documentation for possible values
directory: '/frontend' # Location of package manifests
schedule:
interval: "weekly"
interval: 'weekly'
6 changes: 0 additions & 6 deletions .prettierrc

This file was deleted.

2 changes: 1 addition & 1 deletion README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ VITE_SERVER_URL=<URL>
### Опциональный параметр ###
# Второстепенный сервер в случае неисправности основного
# Второстепенный сервер в случае неисправности основного
VITE_SERVER_URL_SECOND=<URL>
# В качестве основного сервера можно использовать наш -> https://api.spo-diary.ru
Expand Down
8 changes: 4 additions & 4 deletions __tests__/base/b.test.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { it, expect, describe, vitest } from 'vitest'
import {
formatDate,
getTimeRemaining,
Expand All @@ -8,17 +7,18 @@ import {
setLessonDetails,
sortByDay,
textToLink,
truncateString,
truncateString
} from '@utils'
import { describe, expect, it, vitest } from 'vitest'
import { IMarksByDay } from '../../src/components'
import {
expectedLessonDetailsInvalid,
expectedLessonDetailsValid,
mockLesson,
mockLessonInvalid,
mockMarksByDay,
mockTextWithLinks,
mockTextWithLinks
} from './mocs'
import { IMarksByDay } from '../../src/components'

describe('Тесты базовых утилит', () => {
/** isToday **/
Expand Down
50 changes: 25 additions & 25 deletions __tests__/base/mocs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,42 +11,42 @@ export const mockLesson: Lesson = {
endTime: '2023-01-01T11:30:00',
timetable: {
classroom: { id: 1, building: 'A', name: '101' },
teacher: { id: 2, lastName: 'Smith', firstName: 'John', middleName: 'Doe' },
teacher: { id: 2, lastName: 'Smith', firstName: 'John', middleName: 'Doe' }
},
gradebook: {
absenceType: 'IsAbsent',
id: 123,
lessonType: 'Lecture',
themes: ['Theme 1', 'Theme 2'],
},
themes: ['Theme 1', 'Theme 2']
}
}

export const mockLessonInvalid: Lesson = {
endTime: '',
startTime: '',
name: 'Math',
timetable: {
classroom: { id: 1, building: 'A', name: '' },
classroom: { id: 1, building: 'A', name: '' }
},
gradebook: {
absenceType: 'IsAbsent',
id: null,
lessonType: '',
tasks: undefined,
themes: ['Theme 1', 'Theme 2'],
themes: ['Theme 1', 'Theme 2']
},
tasks: undefined,
tasks: undefined
}

export const mockMarksByDay: IMarksByDay = {
'2023-01-01': {
Math: [5, 5, 5],
Physics: [4, 5, 4],
Physics: [4, 5, 4]
},
'2023-01-02': {
English: [4, 5, 5],
Chemistry: [5, 5, 5],
},
Chemistry: [5, 5, 5]
}
}

/** Ожидаемые данные **/
Expand All @@ -57,35 +57,35 @@ export const expectedLessonDetailsValid = {
absenceType: 'IsAbsent',
id: 123,
lessonType: 'Lecture',
themes: ['Theme 1', 'Theme 2'],
themes: ['Theme 1', 'Theme 2']
},
timetable: {
classroom: {
id: 0,
building: '',
name: '101',
name: '101'
},
teacher: {
id: 2,
lastName: 'Smith',
firstName: 'John',
middleName: 'Doe',
},
middleName: 'Doe'
}
},
startTime: '2023-01-01T10:00:00',
endTime: '2023-01-01T11:30:00',
endTime: '2023-01-01T11:30:00'
},
lessonMainInfo: {
name: 'Math',
lessonType: 'Lecture',
themes: ['Theme 1', 'Theme 2'],
teacherName: 'Smith John Doe',
teacherName: 'Smith John Doe'
},
lessonTimePlaceInfo: {
startTime: '2023-01-01T10:00:00',
endTime: '2023-01-01T11:30:00',
classroomName: '101',
},
classroomName: '101'
}
}

export const expectedLessonDetailsInvalid = {
Expand All @@ -96,33 +96,33 @@ export const expectedLessonDetailsInvalid = {
id: 0,
lessonType: 'Не задан',
tasks: undefined,
themes: ['Theme 1', 'Theme 2'],
themes: ['Theme 1', 'Theme 2']
},
timetable: {
classroom: {
id: 0,
building: '',
name: 'Нет кабинета',
name: 'Нет кабинета'
},
teacher: {
id: 0,
lastName: '',
firstName: '',
middleName: '',
},
middleName: ''
}
},
startTime: 'Что-то не так с датой',
endTime: 'Что-то не так с датой',
endTime: 'Что-то не так с датой'
},
lessonMainInfo: {
name: 'Math',
lessonType: 'Не задан',
themes: ['Theme 1', 'Theme 2'],
teacherName: 'Не указан',
teacherName: 'Не указан'
},
lessonTimePlaceInfo: {
startTime: 'Ошибка',
endTime: 'Ошибка',
classroomName: 'Нет кабинета',
},
classroomName: 'Нет кабинета'
}
}
28 changes: 14 additions & 14 deletions __tests__/formatted/f.test.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import { describe, expect, it } from 'vitest'
import { PerformanceCurrent } from '@diary-spo/shared'
import {
convertStringToTime,
formatDate,
formatDateForRequest,
formatLessonDate,
formatLessonName,
formatStatisticsData,
formatStatisticsData
} from '@utils'
import { PerformanceCurrent } from '@diary-spo/shared'
import { describe, expect, it } from 'vitest'

describe('Тесты утилит для форматирования', () => {
/** convertStringToTime **/
it('должна конвертировать строку времени в объект Date', async ({
expect,
expect
}) => {
const baseDate = new Date(2023, 10, 1, 0, 0, 0)
const result = convertStringToTime('14:30', baseDate)
Expand All @@ -21,7 +21,7 @@ describe('Тесты утилит для форматирования', () => {
})

it('должна вернуть null для некорректного формата времени', async ({
expect,
expect
}) => {
const baseDate = new Date(2023, 10, 1, 0, 0, 0)
const result = convertStringToTime('25:70', baseDate)
Expand Down Expand Up @@ -66,21 +66,21 @@ describe('Тесты утилит для форматирования', () => {
daysWithMarks: [
{
day: new Date(),
markValues: ['Five', 'Five', 'Four'],
},
markValues: ['Five', 'Five', 'Four']
}
],
subjectName: 'Иностранный язык в профессиональной деятельности',
},
subjectName: 'Иностранный язык в профессиональной деятельности'
}
],
monthsWithDays: [
{
month: {
name: 'Сентябрь',
num: 9,
num: 9
},
daysWithLessons: [new Date()],
},
],
daysWithLessons: [new Date()]
}
]
}

it('должна вернуть правильные данные при валидных параметрах', () => {
Expand All @@ -99,7 +99,7 @@ describe('Тесты утилит для форматирования', () => {
'2': 0,
'3': 0,
'4': 1,
'5': 2,
'5': 2
})
})

Expand Down
18 changes: 9 additions & 9 deletions __tests__/marks/m.test.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { expect, describe, it } from 'vitest'
import { Task } from '@diary-spo/shared'
import {
calculateAverageMark,
createSubjectMarksMap,
extractMarksByDay,
getBackgroundColor,
getSize,
setDefaultMark,
setDefaultMark
} from '@utils'
import { Task } from '@diary-spo/shared'
import { describe, expect, it } from 'vitest'

import {
expectedExtractByDayData,
Expand All @@ -17,7 +17,7 @@ import {
invalidPerformanceMockData,
mockData,
mockDataWithoutMarks,
performanceMockData,
performanceMockData
} from './mocks'

describe('calculateAverageMark', () => {
Expand Down Expand Up @@ -121,7 +121,7 @@ describe('setDefaultMark', () => {
id: 0,
type: undefined,
isRequired: true,
mark: null,
mark: null
}

const mark = setDefaultMark(task)
Expand All @@ -134,7 +134,7 @@ describe('setDefaultMark', () => {
id: 0,
isRequired: false,
type: 'Home',
mark: null,
mark: null
}

const mark = setDefaultMark(task)
Expand All @@ -147,7 +147,7 @@ describe('setDefaultMark', () => {
id: 0,
isRequired: false,
type: undefined,
mark: 'Five',
mark: 'Five'
}

const mark = setDefaultMark(task)
Expand All @@ -160,7 +160,7 @@ describe('setDefaultMark', () => {
id: 0,
isRequired: false,
type: undefined,
mark: 'Unknown',
mark: 'Unknown'
}

const mark = setDefaultMark(task)
Expand All @@ -173,7 +173,7 @@ describe('setDefaultMark', () => {
id: 0,
type: undefined,
isRequired: false,
mark: null,
mark: null
}

const mark = setDefaultMark(task)
Expand Down
Loading

0 comments on commit 95ca04a

Please sign in to comment.