Add interface for hjarntorget and skkolplattformen

This commit is contained in:
Emil Lindqvist 2021-10-11 09:57:22 +02:00 committed by Viktor Sarström
parent aeeab7feb6
commit 2162221322
3 changed files with 4 additions and 3 deletions

View File

@ -21,7 +21,7 @@ describe('api', () => {
fetch = jest.fn().mockResolvedValue(response)
response.text.mockResolvedValue('<html></html>')
CookieManager.clearAll()
api = init(fetch, CookieManager)
api = init(fetch, CookieManager) as ApiSkolplattformen
})
describe('#login', () => {
it('exposes token', async () => {

View File

@ -27,6 +27,7 @@ import * as parse from './parse/index'
import wrap, { Fetcher, FetcherOptions } from '../../api/lib/fetcher'
import * as fake from './fakeData'
import { checkStatus } from './loginStatusChecker'
import { Api } from '../../api/lib/api'
const fakeResponse = <T>(data: T): Promise<T> =>
new Promise((res) => setTimeout(() => res(data), 200 + Math.random() * 800))
@ -49,7 +50,7 @@ interface SSOSystems {
[name: string]: boolean | undefined
}
export class ApiSkolplattformen extends EventEmitter {
export class ApiSkolplattformen extends EventEmitter implements Api {
private fetch: Fetcher
private personalNumber?: string

View File

@ -11,7 +11,7 @@ import {
Skola24Child,
EtjanstChild,
TimetableEntry,
ScheduleItem
ScheduleItem,
} from './types'
export interface Api {