createVersionedContextForTesting()
Home > @backstage/version-bridge > createVersionedContextForTesting
Creates a helper for writing tests towards multiple different combinations of versions provided from a context.
Signature:
function createVersionedContextForTesting(key: string): {
    set(versions: { [version in number]: unknown; }): void;
    reset(): void;
};
Parameters
| Parameter | Type | Description | 
|---|---|---|
| key | string | A key that uniquely identifies the context. | 
{ set(versions: { [version in number]: unknown; }): void; reset(): void; }
Example
const context = createVersionedContextForTesting('my-context');
afterEach(() => {
  context.reset();
});
it('should work when provided with version 1', () => {
  context.set({1: 'value-for-version-1'})
  // ...
})