@@ -3,6 +3,7 @@ import React, { type ComponentProps } from 'react';
33import {
44 renderWithActiveConnection ,
55 screen ,
6+ cleanup ,
67} from '@mongodb-js/testing-library-compass' ;
78import sinon from 'sinon' ;
89import {
@@ -43,14 +44,7 @@ describe('CollectionHeaderActions [Component]', function () {
4344 workspaceService : Partial < WorkspacesService > = { } ,
4445 connectionInfo ?: ConnectionInfo
4546 ) => {
46- const defaultProps = {
47- namespace : 'test.test' ,
48- isReadonly : false ,
49- onOpenMockDataModal : sinon . stub ( ) ,
50- ...props ,
51- } ;
52-
53- const ui = (
47+ return await renderWithActiveConnection (
5448 < CompassExperimentationProvider
5549 useAssignment = { mockUseAssignment }
5650 assignExperiment = { sinon . stub ( ) }
@@ -59,13 +53,17 @@ describe('CollectionHeaderActions [Component]', function () {
5953 value = { workspaceService as WorkspacesService }
6054 >
6155 < PreferencesProvider value = { preferences } >
62- < CollectionHeaderActions { ...defaultProps } />
56+ < CollectionHeaderActions
57+ namespace = "test.test"
58+ isReadonly = { false }
59+ onOpenMockDataModal = { sinon . stub ( ) }
60+ { ...props }
61+ />
6362 </ PreferencesProvider >
6463 </ WorkspacesServiceProvider >
65- </ CompassExperimentationProvider >
64+ </ CompassExperimentationProvider > ,
65+ connectionInfo
6666 ) ;
67-
68- return await renderWithActiveConnection ( ui , connectionInfo ) ;
6967 } ;
7068
7169 context ( 'when the collection is not readonly' , function ( ) {
@@ -77,6 +75,8 @@ describe('CollectionHeaderActions [Component]', function () {
7775 } ) ;
7876 } ) ;
7977
78+ afterEach ( cleanup ) ;
79+
8080 it ( 'does not render any buttons' , function ( ) {
8181 expect (
8282 screen . queryByTestId ( 'collection-header-actions-edit-button' )
@@ -137,6 +137,8 @@ describe('CollectionHeaderActions [Component]', function () {
137137 ) ;
138138 } ) ;
139139
140+ afterEach ( cleanup ) ;
141+
140142 it ( 'shows a button to edit the view pipeline' , function ( ) {
141143 expect (
142144 screen . getByTestId ( 'collection-header-actions-edit-button' )
@@ -175,6 +177,8 @@ describe('CollectionHeaderActions [Component]', function () {
175177 ) ;
176178 } ) ;
177179
180+ afterEach ( cleanup ) ;
181+
178182 it ( 'shows a button to return to the view' , function ( ) {
179183 expect (
180184 screen . getByTestId ( 'collection-header-actions-return-to-view-button' )
0 commit comments