Skip to content

Instantly share code, notes, and snippets.

@larkintuckerllc
Last active March 7, 2022 19:28
Show Gist options
  • Save larkintuckerllc/84a7943b1a8a90e1ca75a9fd7bf3ea9a to your computer and use it in GitHub Desktop.
Save larkintuckerllc/84a7943b1a8a90e1ca75a9fd7bf3ea9a to your computer and use it in GitHub Desktop.
import React from 'react';
import { Entity } from '@backstage/catalog-model';
import { EntityProvider } from '@backstage/plugin-catalog-react';
import { createDevApp } from '@backstage/dev-utils';
import { TestApiProvider } from '@backstage/test-utils';
import { myPluginPlugin, EntityMyPluginContent } from '../src/plugin';
import { MyPluginApi, myPluginApiRef } from '../src';
const mockEntity: Entity = {
...
};
class MockMyPluginClient implements MyPluginApi {
async getHealth(): Promise<{ status: string; }> {
return { status: 'ok'};
}
}
createDevApp()
.registerPlugin(myPluginPlugin)
.addPage({
path: '/fixture-1',
title: 'Fixture 1',
element: (
<TestApiProvider
apis={[[myPluginApiRef, new MockMyPluginClient()]]}
>
<EntityProvider entity={mockEntity}>
<EntityMyPluginContent />
</EntityProvider>
</TestApiProvider>
),
})
.render();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment