Skip to content

Commit

Permalink
fix: typing and test
Browse files Browse the repository at this point in the history
  • Loading branch information
star0202 committed Jun 27, 2023
1 parent 6dab78c commit 16f3bf2
Show file tree
Hide file tree
Showing 18 changed files with 135 additions and 178 deletions.
8 changes: 6 additions & 2 deletions src/types/params/SchoolMajorinfo.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import { DefaultParamWithSchoolParam } from '.'
import { DefaultParam } from '.'

export interface SchoolMajorinfoParam extends DefaultParamWithSchoolParam {
export interface SchoolMajorinfoParam extends DefaultParam {
/** 시도교육청코드 */
readonly ATPT_OFCDC_SC_CODE: string
/** 표준학교코드 */
readonly SD_SCHUL_CODE?: string
/** 주야과정명 */
readonly DGHT_CRSE_SC_NM?: string
/** 계열명 */
Expand Down
8 changes: 6 additions & 2 deletions src/types/params/SchulAflcoinfo.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import { DefaultParamWithSchoolParam } from '.'
import { DefaultParam } from '.'

export interface SchulAflcoinfoParam extends DefaultParamWithSchoolParam {
export interface SchulAflcoinfoParam extends DefaultParam {
/** 시도교육청코드 */
readonly ATPT_OFCDC_SC_CODE: string
/** 표준학교코드 */
readonly SD_SCHUL_CODE?: string
/** 주야과정명 */
readonly DGHT_CRSE_SC_NM?: string
}
6 changes: 3 additions & 3 deletions src/types/responses/AcaInsTiInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ export interface AcaInsTiInfoResponse {
/** 휴원종료일자 */
readonly CAA_END_YMD: string | null
/** 정원합계 */
readonly TOFOR_SMTOT: string
readonly TOFOR_SMTOT: number
/** 일시수용능력인원합계 */
readonly DTM_RCPTN_ABLTY_NMPR_SMTOT: string
readonly DTM_RCPTN_ABLTY_NMPR_SMTOT: number
/** 분야명 */
readonly REALM_SC_NM: string
/** 교습계열명 */
readonly LE_ORD_NM: string
/** 교습과정목록명 */
readonly LE_CRSE_LIST_NM: string
readonly LE_CRSE_LIST_NM: string | null
/** 교습과정명 */
readonly LE_CRSE_NM: string
/** 인당수강료내용 */
Expand Down
2 changes: 1 addition & 1 deletion src/types/responses/MealServiceDietInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export interface MealServiceDietInfoResponse extends BaseSchoolResponse {
/** 급식일자 */
readonly MLSV_YMD: string
/** 급식인원수 */
readonly MLSV_FGR: string
readonly MLSV_FGR: number
/** 요리명 */
readonly DDISH_NM: string
/** 원산지정보 */
Expand Down
6 changes: 3 additions & 3 deletions src/types/responses/SchoolSchedule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ export interface SchoolScheduleResponse extends BaseSchoolResponse {
/** 1학년행사여부 */
readonly ONE_GRADE_EVENT_YN: string
/** 2학년행사여부 */
readonly TWO_GRADE_EVENT_YN: string
readonly TW_GRADE_EVENT_YN: string
/** 3학년행사여부 */
readonly THREE_GRADE_EVENT_YN: string
/** 4학년행사여부 */
readonly FOUR_GRADE_EVENT_YN: string
readonly FR_GRADE_EVENT_YN: string
/** 5학년행사여부 */
readonly FIVE_GRADE_EVENT_YN: string
readonly FIV_GRADE_EVENT_YN: string
/** 6학년행사여부 */
readonly SIX_GRADE_EVENT_YN: string
/** 수정일 */
Expand Down
20 changes: 9 additions & 11 deletions tests/AcaInsTiInfo.test.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
import type { AcaInsTiInfoResponse } from '../src'
import { AE, AN } from './constants'
import { AE } from './constants'
import { neis } from './utils'

const params = {
ATPT_OFCDC_SC_CODE: AE,
}

describe('AcaInsTiInfo', () => {
it('should return AcaInsTiInfoResponse[]', async () => {
const data = await neis.getAcademy({
ATPT_OFCDC_SC_CODE: AE,
})
const data = await neis.getAcademy(params)

expect(data).toMatchObject<AcaInsTiInfoResponse[]>(data)
expect(data)
})

it('should return AcaInsTiInfoResponse', async () => {
const data = await neis.getAcademyOne({
ATPT_OFCDC_SC_CODE: AE,
ACA_ASNUM: AN,
})
const data = await neis.getAcademyOne(params)

expect(data).toMatchObject<AcaInsTiInfoResponse>(data)
expect(data)
})
})
21 changes: 9 additions & 12 deletions tests/ClassInfo.test.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,21 @@
import type { ClassInfoResponse } from '../src'
import { AE, SE } from './constants'
import { neis } from './utils'

const params = {
ATPT_OFCDC_SC_CODE: AE,
SD_SCHUL_CODE: SE,
}

describe('ClassInfo', () => {
it('should return ClassInfoResponse[]', async () => {
const data = await neis.getClass({
ATPT_OFCDC_SC_CODE: AE,
SD_SCHUL_CODE: SE,
})
const data = await neis.getClass(params)

expect(data).toMatchObject<ClassInfoResponse[]>(data)
expect(data)
})

it('should return ClassInfoResponse', async () => {
const data = await neis.getClassOne({
ATPT_OFCDC_SC_CODE: AE,
SD_SCHUL_CODE: SE,
GRADE: '1',
})
const data = await neis.getClassOne(params)

expect(data).toMatchObject<ClassInfoResponse>(data)
expect(data)
})
})
27 changes: 10 additions & 17 deletions tests/ElsTimetable.test.ts
Original file line number Diff line number Diff line change
@@ -1,28 +1,21 @@
import type { ElsTimetableResponse } from '../src'
import { AE, ELS, YMD } from './constants'
import { AE, ELS } from './constants'
import { neis } from './utils'

const params = {
ATPT_OFCDC_SC_CODE: AE,
SD_SCHUL_CODE: ELS,
}

describe('ElsTimetable', () => {
it('should return ElsTimetableResponse[]', async () => {
const data = await neis.getElsTimetable({
ATPT_OFCDC_SC_CODE: AE,
SD_SCHUL_CODE: ELS,
ALL_TI_YMD: YMD,
})
const data = await neis.getElsTimetable(params)

expect(data).toMatchObject<ElsTimetableResponse[]>(data)
expect(data)
})

it('should return ElsTimetableResponse', async () => {
const data = await neis.getElsTimetableOne({
ATPT_OFCDC_SC_CODE: AE,
SD_SCHUL_CODE: ELS,
ALL_TI_YMD: YMD,
GRADE: '1',
CLASS_NM: '1',
PERIO: '1',
})
const data = await neis.getElsTimetableOne(params)

expect(data).toMatchObject<ElsTimetableResponse>(data)
expect(data)
})
})
26 changes: 10 additions & 16 deletions tests/HisTimetable.test.ts
Original file line number Diff line number Diff line change
@@ -1,27 +1,21 @@
import type { HisTimetableResponse } from '../src'
import { AE, HIS, YMD } from './constants'
import { AE, HIS } from './constants'
import { neis } from './utils'

const params = {
ATPT_OFCDC_SC_CODE: AE,
SD_SCHUL_CODE: HIS,
}

describe('HisTimetable', () => {
it('should return HisTimetableResponse[]', async () => {
const data = await neis.getHisTimetable({
ATPT_OFCDC_SC_CODE: AE,
SD_SCHUL_CODE: HIS,
ALL_TI_YMD: YMD,
})
const data = await neis.getHisTimetable(params)

expect(data).toMatchObject<HisTimetableResponse[]>(data)
expect(data)
})

it('should return HisTimetableResponse', async () => {
const data = await neis.getHisTimetableOne({
ATPT_OFCDC_SC_CODE: AE,
SD_SCHUL_CODE: HIS,
ALL_TI_YMD: YMD,
GRADE: '1',
CLASS_NM: '1',
})
const data = await neis.getHisTimetableOne(params)

expect(data).toMatchObject<HisTimetableResponse>(data)
expect(data)
})
})
23 changes: 10 additions & 13 deletions tests/MealServiceDietInfo.test.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,21 @@
import type { MealServiceDietInfoResponse } from '../src'
import { AE, SE, YMD } from './constants'
import { AE, SE } from './constants'
import { neis } from './utils'

const params = {
ATPT_OFCDC_SC_CODE: AE,
SD_SCHUL_CODE: SE,
}

describe('MealServiceDietInfo', () => {
it('should return MealServiceDietInfoResponse[]', async () => {
const data = await neis.getMeal({
ATPT_OFCDC_SC_CODE: AE,
SD_SCHUL_CODE: SE,
})
const data = await neis.getMeal(params)

expect(data).toMatchObject<MealServiceDietInfoResponse[]>(data)
expect(data)
})

it('should return MealServiceDietInfoResponse', async () => {
const data = await neis.getMealOne({
ATPT_OFCDC_SC_CODE: AE,
SD_SCHUL_CODE: SE,
MLSV_YMD: YMD,
})
const data = await neis.getMealOne(params)

expect(data).toMatchObject<MealServiceDietInfoResponse>(data)
expect(data)
})
})
27 changes: 10 additions & 17 deletions tests/MisTimetable.test.ts
Original file line number Diff line number Diff line change
@@ -1,28 +1,21 @@
import type { MisTimetableResponse } from '../src'
import { AE, MIS, YMD } from './constants'
import { AE, MIS } from './constants'
import { neis } from './utils'

const params = {
ATPT_OFCDC_SC_CODE: AE,
SD_SCHUL_CODE: MIS,
}

describe('MisTimetable', () => {
it('should return MisTimetableResponse[]', async () => {
const data = await neis.getMisTimetable({
ATPT_OFCDC_SC_CODE: AE,
SD_SCHUL_CODE: MIS,
ALL_TI_YMD: YMD,
})
const data = await neis.getMisTimetable(params)

expect(data).toMatchObject<MisTimetableResponse[]>(data)
expect(data)
})

it('should return MisTimetableResponse', async () => {
const data = await neis.getMisTimetableOne({
ATPT_OFCDC_SC_CODE: AE,
SD_SCHUL_CODE: MIS,
ALL_TI_YMD: YMD,
GRADE: '1',
CLASS_NM: '1',
PERIO: '1',
})
const data = await neis.getMisTimetableOne(params)

expect(data).toMatchObject<MisTimetableResponse>(data)
expect(data)
})
})
22 changes: 11 additions & 11 deletions tests/SchoolInfo.test.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
import type { SchoolInfoResponse } from '../src'
import { AE, SE } from './constants'
import { AE } from './constants'
import { neis } from './utils'

const params = {
ATPT_OFCDC_SC_CODE: AE,
}

describe('SchoolInfo', () => {
it('should return SchoolInfoResponse[]', async () => {
const data = await neis.getSchool({
ATPT_OFCDC_SC_CODE: AE,
})
const data = await neis.getSchool(params)

expect(data).toMatchObject<SchoolInfoResponse[]>(data)
data.forEach((school) => {
expect(school)
})
})

it('should return SchoolInfoResponse', async () => {
const data = await neis.getSchoolOne({
ATPT_OFCDC_SC_CODE: AE,
SD_SCHUL_CODE: SE,
})
const data = await neis.getSchoolOne(params)

expect(data).toMatchObject<SchoolInfoResponse>(data)
expect(data)
})
})
21 changes: 9 additions & 12 deletions tests/SchoolMajorinfo.test.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,20 @@
import type { SchoolMajorinfoResponse } from '../src'
import { AE, SE } from './constants'
import { AE } from './constants'
import { neis } from './utils'

const params = {
ATPT_OFCDC_SC_CODE: AE,
}

describe('SchoolMajorinfo', () => {
it('should return SchoolMajorinfoResponse[]', async () => {
const data = await neis.getMajor({
ATPT_OFCDC_SC_CODE: AE,
SD_SCHUL_CODE: SE,
})
const data = await neis.getMajor(params)

expect(data).toMatchObject<SchoolMajorinfoResponse[]>(data)
expect(data)
})

it('should return SchoolMajorinfoResponse', async () => {
const data = await neis.getMajorOne({
ATPT_OFCDC_SC_CODE: AE,
SD_SCHUL_CODE: SE,
})
const data = await neis.getMajorOne(params)

expect(data).toMatchObject<SchoolMajorinfoResponse>(data)
expect(data)
})
})
23 changes: 10 additions & 13 deletions tests/SchoolSchedule.test.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,21 @@
import type { SchoolScheduleResponse } from '../src'
import { AE, SE, YMD } from './constants'
import { AE, SE } from './constants'
import { neis } from './utils'

const params = {
ATPT_OFCDC_SC_CODE: AE,
SD_SCHUL_CODE: SE,
}

describe('SchoolSchedule', () => {
it('should return SchoolScheduleResponse[]', async () => {
const data = await neis.getSchedule({
ATPT_OFCDC_SC_CODE: AE,
SD_SCHUL_CODE: SE,
})
const data = await neis.getSchedule(params)

expect(data).toMatchObject<SchoolScheduleResponse[]>(data)
expect(data)
})

it('should return SchoolScheduleResponse', async () => {
const data = await neis.getScheduleOne({
ATPT_OFCDC_SC_CODE: AE,
SD_SCHUL_CODE: SE,
AA_YMD: YMD,
})
const data = await neis.getScheduleOne(params)

expect(data).toMatchObject<SchoolScheduleResponse>(data)
expect(data)
})
})
Loading

0 comments on commit 16f3bf2

Please sign in to comment.