Is it possible to test a js function that is not exposed in type itself?


If I have a c3 type named: model.c3typ with the content of

entity type model
    operation1: member function(): js server

inside model.js, I have

function operation1(){


function operationPrivate(){

My question is that whether I can call operationPrivate() in the jasmine test directly. If yes, how? Thanks.


You cannot, you need to expose your functions so that you can unit test them.


@bachr is correct—you will need to add your function to the type definition for model. But you can also mark it as a private function:

operationPrivate: private function(): js server