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


#1

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(){
xxxx

operationPrivate()
}

function operationPrivate(){
}

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


#2

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


#3

@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