test: write test codes with gh workflow
This commit is contained in:
parent
d2d6b5f6e1
commit
ce0ca5988e
7 changed files with 56 additions and 5 deletions
14
tests/School.test.ts
Normal file
14
tests/School.test.ts
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
import assert from 'node:assert'
|
||||
import test from 'node:test'
|
||||
import { comcigan } from '.'
|
||||
import { School } from '../src'
|
||||
|
||||
test('Search schools by name', async () => {
|
||||
const schools = await comcigan.searchSchools('중학교')
|
||||
assert(schools.length > 0)
|
||||
})
|
||||
|
||||
test('Get school by name', async () => {
|
||||
const school = await School.fromName('중학교')
|
||||
assert(school)
|
||||
})
|
||||
15
tests/Timetable.test.ts
Normal file
15
tests/Timetable.test.ts
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
import assert from 'node:assert'
|
||||
import test from 'node:test'
|
||||
import { comcigan } from '.'
|
||||
|
||||
test('Get timetable by code', async () => {
|
||||
const schools = await comcigan.searchSchools('중학교')
|
||||
const timetable = await comcigan.getTimetable(schools[0].code)
|
||||
assert(timetable)
|
||||
})
|
||||
|
||||
test('Get timetable by school', async () => {
|
||||
const schools = await comcigan.searchSchools('중학교')
|
||||
const timetable = await schools[0].getTimetable()
|
||||
assert(timetable)
|
||||
})
|
||||
3
tests/index.ts
Normal file
3
tests/index.ts
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
import Comcigan from '../src'
|
||||
|
||||
export const comcigan = new Comcigan()
|
||||
Loading…
Add table
Add a link
Reference in a new issue