Skip to content

Commit 4ca34be

Browse files
ref(js): Convert feature.spec to tsx (#51107)
1 parent d295212 commit 4ca34be

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

static/app/components/acl/feature.spec.jsx renamed to static/app/components/acl/feature.spec.tsx

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -172,9 +172,10 @@ describe('Feature', function () {
172172
});
173173

174174
it('checks ConfigStore.config.features (e.g. `organizations:create`)', function () {
175-
ConfigStore.config = {
175+
ConfigStore.config = TestStubs.Config({
176176
features: new Set(['organizations:create']),
177-
};
177+
});
178+
178179
render(<Feature features={['organizations:create']}>{childrenMock}</Feature>, {
179180
context: routerContext,
180181
});
@@ -192,15 +193,19 @@ describe('Feature', function () {
192193
describe('no children', function () {
193194
it('should display renderDisabled with no feature', function () {
194195
render(
195-
<Feature features={['nope']} renderDisabled={() => <span>disabled</span>} />,
196+
<Feature features={['nope']} renderDisabled={() => <span>disabled</span>}>
197+
<div>The Child</div>
198+
</Feature>,
196199
{context: routerContext}
197200
);
198201
expect(screen.getByText('disabled')).toBeInTheDocument();
199202
});
200203

201204
it('should display be empty when on', function () {
202205
render(
203-
<Feature features={['org-bar']} renderDisabled={() => <span>disabled</span>} />,
206+
<Feature features={['org-bar']} renderDisabled={() => <span>disabled</span>}>
207+
<div>The Child</div>
208+
</Feature>,
204209
{context: routerContext}
205210
);
206211
expect(screen.queryByText('disabled')).not.toBeInTheDocument();
@@ -269,18 +274,17 @@ describe('Feature', function () {
269274

270275
beforeEach(function () {
271276
hookFn = jest.fn(() => null);
272-
HookStore.hooks['feature-disabled:org-baz'] = [hookFn];
273-
HookStore.hooks['feature-disabled:test-hook'] = [hookFn];
277+
HookStore.add('feature-disabled:sso-basic', hookFn);
274278
});
275279

276280
afterEach(function () {
277-
delete HookStore.hooks['feature-disabled:org-baz'];
281+
HookStore.remove('feature-disabled:sso-basic', hookFn);
278282
});
279283

280284
it('uses hookName if provided', function () {
281285
const children = <div>The Child</div>;
282286
render(
283-
<Feature features={['org-bazar']} hookName="feature-disabled:test-hook">
287+
<Feature features={['org-bazar']} hookName="feature-disabled:sso-basic">
284288
{children}
285289
</Feature>,
286290
{context: routerContext}

0 commit comments

Comments
 (0)