Generating the test cases for the objects in Angular

Viewed 19

I have a function which returns the json object , I need to implement the test cases for the function which returns the object

private populateTableData(){
const gridData : any[] = this.tableData; // this.tableData is @Input variable
if(gridData){
const tableElements = gridData.filter(
(v) => v.identifier == 'tableData'
);    
}
}

Json data which comes as an Input for the function

[{
"identifier": "tableData",
"data": [
{
"displayName":"name",
"displayOrder": 1,
"bindKey":"name"
},
{
"displayName":"email",
"displayOrder": 2,
"bindKey":"email"
}
]
}]

How do I write the test cases for the function populateTableData() which process the json and stores the objects with identifier 'tableData'

Test Case need to implement using jasmine

describe('populateTableData', ()=>{
it('should filter the tableData with the identifier tableData', () => {
//need to implement  all the test cases possible for the above function
})
})
0 Answers
Related