app: fix app test on windows

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2021-03-03 15:58:44 +01:00
parent 1b8b40cfee
commit 415a3a42da
3 changed files with 35 additions and 10 deletions
+25
View File
@@ -0,0 +1,25 @@
---
'@backstage/create-app': patch
---
Updated the default `App` test to work better on Windows.
To apply this change to an existing app, replace the `process.env.APP_CONFIG` definition in `packages/app/src/App.test.tsx` with the following:
```ts
process.env = {
NODE_ENV: 'test',
APP_CONFIG: [
{
data: {
app: { title: 'Test' },
backend: { baseUrl: 'http://localhost:7000' },
techdocs: {
storageUrl: 'http://localhost:7000/api/techdocs/static/docs',
},
},
context: 'test',
},
] as any,
};
```
+5 -5
View File
@@ -20,9 +20,9 @@ import App from './App';
describe('App', () => {
it('should render', async () => {
Object.defineProperty(process.env, 'APP_CONFIG', {
configurable: true,
value: [
process.env = {
NODE_ENV: 'test',
APP_CONFIG: [
{
data: {
app: {
@@ -39,8 +39,8 @@ describe('App', () => {
},
context: 'test',
},
],
});
] as any,
};
const rendered = await renderWithEffects(<App />);
expect(rendered.baseElement).toBeInTheDocument();
@@ -4,9 +4,9 @@ import App from './App';
describe('App', () => {
it('should render', async () => {
Object.defineProperty(process.env, 'APP_CONFIG', {
configurable: true,
value: [
process.env = {
NODE_ENV: 'test',
APP_CONFIG: [
{
data: {
app: { title: 'Test' },
@@ -17,8 +17,8 @@ describe('App', () => {
},
context: 'test',
},
],
});
] as any,
};
const rendered = await renderWithEffects(<App />);
expect(rendered.baseElement).toBeInTheDocument();