app,cli/templates: better mocking of app config in test

This commit is contained in:
Patrik Oldsberg
2020-06-21 15:17:24 +02:00
parent 6d9aaef9e7
commit d97842a69f
4 changed files with 27 additions and 17 deletions
@@ -8,6 +8,7 @@
"@material-ui/lab": "4.0.0-alpha.45",
"@backstage/cli": "^{{version}}",
"@backstage/core": "^{{version}}",
"@backstage/test-utils": "^{{version}}",
"@backstage/theme": "^{{version}}",
"plugin-welcome": "0.0.0",
"react": "^16.13.1",
@@ -1,15 +1,22 @@
import React from 'react';
import { render } from '@testing-library/react';
import { renderWithEffects } from '@backstage/test-utils';
import App from './App';
describe('App', () => {
it('should render', () => {
it('should render', async () => {
Object.defineProperty(process.env, 'APP_CONFIG', {
configurable: true,
value: [],
value: [
{
data: {
app: { title: 'Test' },
},
context: 'test',
},
],
});
const rendered = render(<App />);
const rendered = await renderWithEffects(<App />);
expect(rendered.baseElement).toBeInTheDocument();
});
});