firefox-devtools / firefox-devtools/profiler

Add tests to check the rendering of the profile info panel

Open
#2,221 2 comments 0 reactions 0 assignees View on GitHub
tests
Dominant language
TypeScript
Stars
1.5k
Forks
491
Avg merge
3d 5h
Merged PRs (30d)
30

Description

The existing coverage about the profile info panel has been lost in a recent PR.
We should have new tests covering this more explicitely.

Here is how this could be done.

1. this could be a new file in `src/test/components/MetaInfo.test.js`
1. it could be something like this (I didn't try it, so you'll likely have to correct it):

```js
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

// @flow
import * as React from 'react';
import { render } from 'react-testing-library';

import { getEmptyProfile } from '../../profile-logic/data-structures';

describe('app/MenuButtons/MetaInfo', () => {
function setup() {
const profile = getEmptyProfile();
// change things in profile.meta, so that they show up correctly in the panel

const results = render(

);
return results;
}

it('matches the snapshot to display information for a profile', () => {
const { container } = setup();
expect(container.firstChild).toMatchSnapshot();
});
});
```

Probably we need to mock the date objects by using https://www.npmjs.com/package/jest-date-mock to be able to handle the timezone differences.

┆Issue is synchronized with this [Jira Task](https://mozilla-hub.atlassian.net/browse/FP-203)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.