Jelajahi Sumber

Remove test for DomContentLoaded event listener

- No longer required as this event listener is not needed manually after deprecation removals
LB Johnston 1 tahun lalu
induk
melakukan
538c654c14
1 mengubah file dengan 3 tambahan dan 9 penghapusan
  1. 3 9
      client/src/entrypoints/admin/core.test.js

+ 3 - 9
client/src/entrypoints/admin/core.test.js

@@ -1,11 +1,9 @@
 jest.mock('../..');
 
-document.addEventListener = jest.fn();
-
-require('./core');
-
 describe('core', () => {
-  const [event] = document.addEventListener.mock.calls[0];
+  beforeAll(() => {
+    require('./core'); // dynamic require to test side effects
+  });
 
   it('exposes the Stimulus application instance for reuse', () => {
     expect(Object.keys(window.wagtail.app)).toEqual(
@@ -25,8 +23,4 @@ describe('core', () => {
       expect.arrayContaining(['Application', 'Controller']),
     );
   });
-
-  it('DOMContentLoaded', () => {
-    expect(event).toBe('DOMContentLoaded');
-  });
 });