-
Notifications
You must be signed in to change notification settings - Fork 33
Description
Hi there, I'm currently migrating a slew of extensions built against the older Contentful UI Extension integration API across to Contentful Apps.
In doing so, I'm looking to implement automated testing to cover the integration between our App implementations and the Contentful UI. I started building a mockable SDK instance, which would work but requires a fair amount of work and also introduces the probability of an inaccurate mock implementation.
I then started exploring another approach where rather than injecting a mocked SDK instance, instead I inject an implementation of the "Contentful Platform" side of the web messaging API with which the SDK integrates. That seems pretty workable and results in tests that are far closer to reality than mocking the SDK.
A considerable caveat to this approach however is that the App SDK maintains a singleton instance of itself as part of its initialisation method and (AFAICT) provides no means to create a new instance in the same global scope.
Please could Contentful expose something like the existing createInitializer() function, allowing explicit creation of a new instance (and ideally with the ability to inject currentGlobal as seen in that function signature) without memoising a singleton instance?
(I say "like the existing createInitializer()", but tbh I would be content if it was exactly that existing function.)