I am currently navigating through new territory, so I appreciate your patience. My current project involves Ionic 2 using Angular 2, Typescript, and Jasmine for unit testing. At this moment, I am faced with the challenge of writing a unit test for a unique scenario. Within my component, I import a third-party library at the top using
import * as thirdparty from "thirdparty-library"
. Subsequently, my component utilizes this library with a call like thirdparty.setup(someStuff, someMoreStuff, anotherFunc)
.
My ultimate goal is to create a mock version of the thirdparty
library that includes its own fabricated version of anotherFunc
, which can be passed from within the unit test. Is there a way to achieve this by passing something in the constructor to override the thirdparty
namespace? Any insights will be greatly appreciated. Thank you!