-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Rydd videre i mocks * Fullfør SMS-mocks * Begynn å flytte forespørsel-mock til msw * Flytt mer av mockene * Slett siste rester av kandidatmock, mock mocken for resten
- Loading branch information
Showing
46 changed files
with
428 additions
and
2,321 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,17 @@ | ||
import { rest } from 'msw'; | ||
import { api } from '../../src/felles/api'; | ||
|
||
export const mockMeg = { | ||
export const mockVeileder = { | ||
fornavn: 'Varg', | ||
etternavn: 'Veileder', | ||
navKontor: '1209', | ||
navIdent: 'Z994161', | ||
}; | ||
|
||
export const mockMeg = { | ||
navIdent: mockVeileder.navIdent, | ||
}; | ||
|
||
export const innloggetBrukerMock = [ | ||
rest.get(api.innloggetBruker, (_, res, ctx) => res(ctx.json(mockMeg))), | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { Sms, SmsStatus } from 'felles/domene/sms/Sms'; | ||
import { rest } from 'msw'; | ||
import { api } from '../../src/felles/api'; | ||
import { mockKandidatlisteMedStilling } from '../kandidat-api/mockKandidatliste'; | ||
import { mockMeg } from '../meg/mock'; | ||
|
||
export const smsApiMock = [ | ||
rest.get(`${api.sms}/:kandidatlisteId`, (req, res, ctx) => { | ||
const sms = mockSms.filter((sms) => sms.kandidatlisteId === req.params.kandidatlisteId); | ||
|
||
if (!sms) { | ||
return res(ctx.status(404)); | ||
} else { | ||
return res(ctx.json(sms)); | ||
} | ||
}), | ||
|
||
rest.get(`${api.sms}/fnr/:fnr`, (req, res, ctx) => { | ||
const sms = mockSms.filter((sms) => sms.fnr === req.params.fnr); | ||
|
||
if (!sms) { | ||
return res(ctx.status(404)); | ||
} else { | ||
return res(ctx.json(sms)); | ||
} | ||
}), | ||
|
||
rest.post(`${api.sms}`, (_, res, ctx) => res(ctx.status(201))), | ||
]; | ||
|
||
const mockSms: Sms[] = [ | ||
{ | ||
id: 1, | ||
kandidatlisteId: mockKandidatlisteMedStilling.kandidatlisteId, | ||
fnr: '123', //mockKandidatlisteMedStilling.kandidater[0].fodselsnr, | ||
opprettet: new Date().toISOString(), | ||
sendt: new Date().toISOString(), | ||
status: SmsStatus.Sendt, | ||
navIdent: mockMeg.navIdent, | ||
}, | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { rest } from 'msw'; | ||
import { api } from '../../src/felles/api'; | ||
|
||
export const synlighetApiMock = [ | ||
rest.get( | ||
`${api.synlighet}/evaluering/:fnr`, | ||
(_, res, ctx) => res(ctx.status(500)) // TODO | ||
), | ||
]; |
Oops, something went wrong.