Last active
March 7, 2022 19:28
-
-
Save larkintuckerllc/84a7943b1a8a90e1ca75a9fd7bf3ea9a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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