I’m using and testing a VbScript API using JavaScript. One part of the VbScript API has a construct, that I must assume is an array, that you can read and write from. I do not have the source code for the VbScript API, nor do I even have access to the system in which it runs for the time being. In my JavaScript test code, which mocks myObj and myFunc, assignments throw an error, not surprisingly, since I’m mocking it as a function.
myObj.myFunc("xyz") = 1
Mocking as an array would not work, since JavaScript uses [] as the accessor.
One solution would be to wrap calls to myFunc with JavaScript, but I was wondering if there might be a more ingenious solution, JavaScript being the pliable language that it is.
I think I’ve answered my own question here… I only need to set and read one value, which is why it was not already wrapped and mocked as an array. The answer is to go ahead and wrap it.
Thanks,
Mike
How about this?
Really it makes no sense trying to simulate the syntax of another language.