Skip to content

unit testing instanceof VcVirtual*Controller #454

Closed Answered by Michaelpalacce
pe1pip asked this question in Q&A
Discussion options

You must be logged in to vote

Here is an example how you can define instances that don't exist as they are not part of the scripting api:

	beforeEach(function () {
        (<any> VcVirtualBusLogicController) = {
			someMethod: () => {
				throw new Error("Not Implemented, add a spy");
			}
		};
    });

    afterEach(function () {
        (<any>VcVirtualBusLogicController) = undefined;
    })

I am not sure how it will apply here, tho. And unit testing this may not even make sense in the first place.

There are many downsides to using instanceof that you can look up if interested. You could try to do something like so:

// SCSIDevice Use this interface moving forward instead of all 4 options or `any`
export interface SCS…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@pe1pip
Comment options

Answer selected by Michaelpalacce
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants