Files
sentinel/static/app/utils/withExperiment.spec.tsx
2024-02-15 17:01:50 +00:00

27 lines
777 B
TypeScript

import {OrganizationFixture} from 'sentry-fixture/organization';
import {render, screen} from 'sentry-test/reactTestingLibrary';
import withExperiment from 'sentry/utils/withExperiment';
describe('withConfig HoC', function () {
beforeEach(function () {
jest.clearAllMocks();
});
function MyComponent(props) {
return <span>{props.experimentAssignment}</span>;
}
it('injects experiment assignment', function () {
const Container = withExperiment(MyComponent, {
// @ts-expect-error This is a test experiment that does not exist, it
// will evalulate to -1 assignment
experiment: 'orgExperiment',
});
render(<Container organization={OrganizationFixture()} />);
expect(screen.getByText('-1')).toBeInTheDocument();
});
});