feat: 🎸 Fake mode for 121212121212, 201212121212 and 1212121212 (#35)
This commit is contained in:
parent
28e04a9808
commit
8d264b9787
|
@ -104,10 +104,19 @@ describe('api', () => {
|
|||
})
|
||||
})
|
||||
describe('fake', () => {
|
||||
it('delivers fake data', async (done) => {
|
||||
const status = await api.login('121212121212')
|
||||
it('sets fake mode for the correct pnr:s', async () => {
|
||||
let status
|
||||
|
||||
status = await api.login('121212121212')
|
||||
expect(status.token).toEqual('fake')
|
||||
|
||||
status = await api.login('201212121212')
|
||||
expect(status.token).toEqual('fake')
|
||||
|
||||
status = await api.login('1212121212')
|
||||
expect(status.token).toEqual('fake')
|
||||
})
|
||||
it('delivers fake data', async (done) => {
|
||||
api.on('login', async () => {
|
||||
const user = await api.getUser()
|
||||
expect(user).toEqual({
|
||||
|
@ -125,6 +134,7 @@ describe('api', () => {
|
|||
|
||||
done()
|
||||
})
|
||||
await api.login('121212121212')
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
|
@ -55,7 +55,7 @@ export class Api extends EventEmitter {
|
|||
}
|
||||
|
||||
async login(personalNumber: string): Promise<LoginStatusChecker> {
|
||||
if (personalNumber === '121212121212') return this.fakeMode()
|
||||
if (personalNumber.endsWith('1212121212')) return this.fakeMode()
|
||||
|
||||
this.isFake = false
|
||||
|
||||
|
|
Loading…
Reference in New Issue