Updated courses model and fixed rich text editor tool bar drop down problem
This commit is contained in:
40
frontend/tests/AboutUsService.spec.ts
Normal file
40
frontend/tests/AboutUsService.spec.ts
Normal file
@@ -0,0 +1,40 @@
|
||||
import { AboutUsService } from "../client/services"
|
||||
import { aboutUsResponse, aboutUsData } from "../utils/user"
|
||||
|
||||
describe('AboutUsService', () => {
|
||||
it('should fetch AboutUs data', async () => {
|
||||
jest.spyOn(global, 'fetch').mockResolvedValue({
|
||||
json: jest.fn().mockResolvedValue(aboutUsResponse),
|
||||
} as Response)
|
||||
|
||||
const response = await AboutUsService.getAbouts()
|
||||
expect(response).toEqual(aboutUsData)
|
||||
})
|
||||
|
||||
it('should create a new AboutUs', async () => {
|
||||
jest.spyOn(global, 'fetch').mockResolvedValue({
|
||||
json: jest.fn().mockResolvedValue({ id: '1' }),
|
||||
} as Response)
|
||||
|
||||
const response = await AboutUsService.createAboutUs(aboutUsData[0])
|
||||
expect(response).toEqual({ id: '1' })
|
||||
})
|
||||
|
||||
it('should update an AboutUs', async () => {
|
||||
jest.spyOn(global, 'fetch').mockResolvedValue({
|
||||
json: jest.fn().mockResolvedValue({ id: '1' }),
|
||||
} as Response)
|
||||
|
||||
const response = await AboutUsService.updateAboutUs(aboutUsData[0].id, aboutUsData[0])
|
||||
expect(response).toEqual({ id: '1' })
|
||||
})
|
||||
|
||||
it('should delete an AboutUs', async () => {
|
||||
jest.spyOn(global, 'fetch').mockResolvedValue({
|
||||
json: jest.fn().mockResolvedValue({ id: '1' }),
|
||||
} as Response)
|
||||
|
||||
const response = await AboutUsService.deleteAboutUs({ id: '1' } as any)
|
||||
expect(response).toEqual({ id: '1' })
|
||||
})
|
||||
})
|
Reference in New Issue
Block a user