Fakultas Ilmu Komputer UI

Commit 9dc478bb authored by Sean Zeliq Urian's avatar Sean Zeliq Urian
Browse files

[RED] test utils

parent d45df083
import { useMainService } from 'services';
import { LogDetail } from 'scenes/ActivityLog/types/types'
import { generateLogMessage, generateLogDetail } from './utils'
const dummyLog = [
{
"author": {
"id": "b629976a-78b7-411d-a377-5eeaad20e7cf",
"username": "admintbcare",
"name": "admintbcare",
"email": "admintbcare@tbcare.cs.ui.ac.id",
"phone_number": "089987654321",
"district": "Beji",
"sub_district": "Kukusan",
"is_admin": true,
"is_verified": true,
"is_active": true
},
"model_name": "Monitoring Case",
"revision_id": "a897a0c0-223d-4fd0-b88e-5d36fc395e7a",
"object_id": "dd815a22-652e-4250-8d33-f882c5ac42a9",
"action_type": "Create",
"recorded_at": "2021-05-27T21:27:05.812719+07:00"
}
]
const dummyLogEmpty = [{}]
const testProps = {
services: {
main: useMainService('dummyToken'),
},
};
it('generate log message', () => {
const ret_val = generateLogMessage(dummyLog, testProps);
expect(ret_val).toBeTruthy()
})
it('generate empty log message', () => {
const func = jest.fn(() => generateLogMessage(dummyLogEmpty, testProps));
expect(func).toHaveReturnedTimes(0);
})
it('generate log detail', () => {
const ret_val = generateLogDetail(dummyLog, testProps);
expect(ret_val).toBeTruthy()
})
it('generate empty log detail', () => {
const func = jest.fn(() => generateLogDetail(dummyLogEmpty, testProps));
expect(func).toHaveReturnedTimes(0);
})
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment