Mock RowNodes in AgGrid for unit test

10 views
Skip to first unread message

RashmiG

unread,
Nov 11, 2021, 10:49:33 PM11/11/21
to Angular and AngularJS discussion

Is there any way to mock the RowNodes of AG-grid in unit test?
I need to check if forEachNode a function call gets executed with the RowNode as a parameter and then test the conditional branches.

Below is my sample code

func1() {
     agGrid.api.forEachNode(node => func2(node));
}

func2(node: RowNode) {
    serviceCall.subscribe(
            (returnValue) => {
                     node.setDataValue('f1', returnValue.p1);
            },
           () => {
                     node.setDataValue(' f1', '');
           }
      );
}


Thanks,

Rashmi

Reply all
Reply to author
Forward
0 new messages