Skip to content

Commit

Permalink
Replace modules in src/test-util with @hypothesis/frontend-testing
Browse files Browse the repository at this point in the history
  • Loading branch information
robertknight committed Oct 6, 2023
1 parent b915e13 commit 36f918d
Show file tree
Hide file tree
Showing 91 changed files with 239 additions and 376 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"@babel/preset-typescript": "^7.16.7",
"@hypothesis/frontend-build": "^2.0.0",
"@hypothesis/frontend-shared": "^6.5.0",
"@hypothesis/frontend-testing": "^1.0.1",
"@npmcli/arborist": "^7.0.0",
"@octokit/rest": "^20.0.1",
"@rollup/plugin-babel": "^6.0.0",
Expand Down
3 changes: 2 additions & 1 deletion src/annotator/anchoring/test/pdf-test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { delay } from '../../../test-util/wait';
import { delay } from '@hypothesis/frontend-testing';

import { matchQuote } from '../match-quote';
import * as pdfAnchoring from '../pdf';
import { TextRange } from '../text-range';
Expand Down
2 changes: 1 addition & 1 deletion src/annotator/components/test/Buckets-test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { checkAccessibility } from '@hypothesis/frontend-testing';
import { mount } from 'enzyme';

import { checkAccessibility } from '../../../test-util/accessibility';
import Buckets from '../Buckets';

describe('Buckets', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/annotator/components/test/Toolbar-test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { checkAccessibility } from '@hypothesis/frontend-testing';
import { mount } from 'enzyme';

import { checkAccessibility } from '../../../test-util/accessibility';
import Toolbar from '../Toolbar';

const noop = () => {};
Expand Down
3 changes: 2 additions & 1 deletion src/annotator/integrations/test/html-test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { delay } from '../../../test-util/wait';
import { delay } from '@hypothesis/frontend-testing';

import { FeatureFlags } from '../../features';
import { HTMLIntegration, $imports } from '../html';

Expand Down
3 changes: 2 additions & 1 deletion src/annotator/integrations/test/image-text-layer-test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { delay } from '../../../test-util/wait';
import { delay } from '@hypothesis/frontend-testing';

import { ImageTextLayer } from '../image-text-layer';

// Sizes and spacing between character bounding boxes in these tests, expressed
Expand Down
2 changes: 1 addition & 1 deletion src/annotator/integrations/test/pdf-metadata-test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { delay } from '@hypothesis/frontend-testing';
import EventEmitter from 'tiny-emitter';

import { delay } from '../../../test-util/wait';
import { PDFMetadata } from '../pdf-metadata';

/**
Expand Down
3 changes: 2 additions & 1 deletion src/annotator/integrations/test/pdf-test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { delay } from '../../../test-util/wait';
import { delay } from '@hypothesis/frontend-testing';

import { RenderingStates } from '../../anchoring/pdf';
import { createPlaceholder } from '../../anchoring/placeholder';
import { FakePDFViewerApplication } from '../../anchoring/test/fake-pdf-viewer-application';
Expand Down
3 changes: 2 additions & 1 deletion src/annotator/integrations/test/vitalsource-test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { delay, waitFor } from '../../../test-util/wait';
import { delay, waitFor } from '@hypothesis/frontend-testing';

import {
VitalSourceInjector,
VitalSourceContentIntegration,
Expand Down
3 changes: 2 additions & 1 deletion src/annotator/test/bucket-bar-client-test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { delay } from '../../test-util/wait';
import { delay } from '@hypothesis/frontend-testing';

import { BucketBarClient, $imports } from '../bucket-bar-client';

describe('BucketBarClient', () => {
Expand Down
3 changes: 2 additions & 1 deletion src/annotator/test/frame-observer-test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { delay, waitFor } from '../../test-util/wait';
import { delay, waitFor } from '@hypothesis/frontend-testing';

import {
FrameObserver,
onDocumentReady,
Expand Down
2 changes: 1 addition & 1 deletion src/annotator/test/guest-test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { delay } from '@hypothesis/frontend-testing';
import { TinyEmitter } from 'tiny-emitter';

import { delay } from '../../test-util/wait';
import { Guest, $imports } from '../guest';

class FakeAdder {
Expand Down
3 changes: 2 additions & 1 deletion src/annotator/test/highlight-clusters-test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { waitFor } from '../../test-util/wait';
import { waitFor } from '@hypothesis/frontend-testing';

import { FeatureFlags } from '../features';
import { HighlightClusterController, $imports } from '../highlight-clusters';

Expand Down
3 changes: 2 additions & 1 deletion src/annotator/test/integration/hypothesis-injector-test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { delay, waitFor } from '../../../test-util/wait';
import { delay, waitFor } from '@hypothesis/frontend-testing';

import { DEBOUNCE_WAIT, onNextDocumentReady } from '../../frame-observer';
import {
HypothesisInjector,
Expand Down
3 changes: 2 additions & 1 deletion src/shared/messaging/test/port-finder-test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { delay } from '../../../test-util/wait';
import { delay } from '@hypothesis/frontend-testing';

import {
MAX_WAIT_FOR_PORT,
POLLING_INTERVAL_FOR_PORT,
Expand Down
3 changes: 2 additions & 1 deletion src/shared/messaging/test/port-provider-test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { delay } from '../../../test-util/wait';
import { delay } from '@hypothesis/frontend-testing';

import { PortProvider, $imports } from '../port-provider';

describe('PortProvider', () => {
Expand Down
3 changes: 2 additions & 1 deletion src/shared/test/frame-error-capture-test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { delay } from '../../test-util/wait';
import { delay } from '@hypothesis/frontend-testing';

import {
captureErrors,
handleErrorsInFrames,
Expand Down
3 changes: 2 additions & 1 deletion src/shared/test/integration/messaging-test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { delay } from '../../../test-util/wait';
import { delay } from '@hypothesis/frontend-testing';

import { ListenerCollection as ListenerCollection_ } from '../../listener-collection';
import {
PortFinder as PortFinder_,
Expand Down
2 changes: 1 addition & 1 deletion src/shared/test/keyboard-navigation-test.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { waitFor } from '@hypothesis/frontend-testing';
import { options as preactOptions, render } from 'preact';
import { useRef } from 'preact/hooks';
import { act } from 'preact/test-utils';

import { waitFor } from '../../test-util/wait';
import { useArrowKeyNavigation } from '../keyboard-navigation';

function Toolbar({ navigationOptions = {} }) {
Expand Down
6 changes: 4 additions & 2 deletions src/sidebar/components/Annotation/test/Annotation-test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import {
checkAccessibility,
mockImportedComponents,
} from '@hypothesis/frontend-testing';
import { mount } from 'enzyme';

import { checkAccessibility } from '../../../../test-util/accessibility';
import { mockImportedComponents } from '../../../../test-util/mock-imported-components';
import * as fixtures from '../../../test/annotation-fixtures';
import Annotation, { $imports } from '../Annotation';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import {
checkAccessibility,
mockImportedComponents,
waitFor,
} from '@hypothesis/frontend-testing';
import { mount } from 'enzyme';
import { act } from 'preact/test-utils';

import { checkAccessibility } from '../../../../test-util/accessibility';
import { mockImportedComponents } from '../../../../test-util/mock-imported-components';
import { waitFor } from '../../../../test-util/wait';
import * as fixtures from '../../../test/annotation-fixtures';
import AnnotationActionBar, { $imports } from '../AnnotationActionBar';

Expand Down
6 changes: 4 additions & 2 deletions src/sidebar/components/Annotation/test/AnnotationBody-test.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import {
checkAccessibility,
mockImportedComponents,
} from '@hypothesis/frontend-testing';
import { mount } from 'enzyme';
import { act } from 'preact/test-utils';

import { checkAccessibility } from '../../../../test-util/accessibility';
import { mockImportedComponents } from '../../../../test-util/mock-imported-components';
import * as fixtures from '../../../test/annotation-fixtures';
import AnnotationBody, { $imports } from '../AnnotationBody';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { checkAccessibility } from '@hypothesis/frontend-testing';
import { mount } from 'enzyme';

import { checkAccessibility } from '../../../../test-util/accessibility';
import AnnotationDocumentInfo from '../AnnotationDocumentInfo';

describe('AnnotationDocumentInfo', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import {
checkAccessibility,
mockImportedComponents,
waitFor,
} from '@hypothesis/frontend-testing';
import { mount } from 'enzyme';
import { act } from 'preact/test-utils';

import { checkAccessibility } from '../../../../test-util/accessibility';
import { mockImportedComponents } from '../../../../test-util/mock-imported-components';
import { waitFor } from '../../../../test-util/wait';
import * as fixtures from '../../../test/annotation-fixtures';
import AnnotationEditor, { $imports } from '../AnnotationEditor';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import {
checkAccessibility,
mockImportedComponents,
} from '@hypothesis/frontend-testing';
import { mount } from 'enzyme';

import { checkAccessibility } from '../../../../test-util/accessibility';
import { mockImportedComponents } from '../../../../test-util/mock-imported-components';
import * as fixtures from '../../../test/annotation-fixtures';
import AnnotationHeader, { $imports } from '../AnnotationHeader';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { GlobeIcon, GroupsIcon, LockIcon } from '@hypothesis/frontend-shared';
import {
checkAccessibility,
mockImportedComponents,
} from '@hypothesis/frontend-testing';
import { mount } from 'enzyme';

import { checkAccessibility } from '../../../../test-util/accessibility';
import { mockImportedComponents } from '../../../../test-util/mock-imported-components';
import AnnotationPublishControl, {
$imports,
} from '../AnnotationPublishControl';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import {
checkAccessibility,
mockImportedComponents,
} from '@hypothesis/frontend-testing';
import { mount } from 'enzyme';

import { checkAccessibility } from '../../../../test-util/accessibility';
import { mockImportedComponents } from '../../../../test-util/mock-imported-components';
import AnnotationQuote, { $imports } from '../AnnotationQuote';

describe('AnnotationQuote', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { checkAccessibility } from '@hypothesis/frontend-testing';
import { mount } from 'enzyme';
import { act } from 'preact/test-utils';

import { checkAccessibility } from '../../../../test-util/accessibility';
import AnnotationReplyToggle from '../AnnotationReplyToggle';

describe('AnnotationReplyToggle', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import {
checkAccessibility,
mockImportedComponents,
} from '@hypothesis/frontend-testing';
import { mount } from 'enzyme';
import { act } from 'preact/test-utils';

import { checkAccessibility } from '../../../../test-util/accessibility';
import { mockImportedComponents } from '../../../../test-util/mock-imported-components';
import AnnotationShareControl, { $imports } from '../AnnotationShareControl';

describe('AnnotationShareControl', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import {
checkAccessibility,
mockImportedComponents,
} from '@hypothesis/frontend-testing';
import { mount } from 'enzyme';

import { checkAccessibility } from '../../../../test-util/accessibility';
import { mockImportedComponents } from '../../../../test-util/mock-imported-components';
import AnnotationShareInfo, { $imports } from '../AnnotationShareInfo';

describe('AnnotationShareInfo', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { checkAccessibility } from '@hypothesis/frontend-testing';
import { mount } from 'enzyme';
import { act } from 'preact/test-utils';

import { checkAccessibility } from '../../../../test-util/accessibility';
import AnnotationTimestamps, { $imports } from '../AnnotationTimestamps';

describe('AnnotationTimestamps', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { checkAccessibility } from '@hypothesis/frontend-testing';
import { mount } from 'enzyme';

import { checkAccessibility } from '../../../../test-util/accessibility';
import AnnotationUser from '../AnnotationUser';

describe('AnnotationUser', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import {
checkAccessibility,
mockImportedComponents,
} from '@hypothesis/frontend-testing';
import { mount } from 'enzyme';

import { checkAccessibility } from '../../../../test-util/accessibility';
import { mockImportedComponents } from '../../../../test-util/mock-imported-components';
import EmptyAnnotation, { $imports } from '../EmptyAnnotation';

describe('EmptyAnnotation', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/sidebar/components/GroupList/test/GroupList-test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { mockImportedComponents } from '@hypothesis/frontend-testing';
import { mount } from 'enzyme';
import { act } from 'preact/test-utils';

import { mockImportedComponents } from '../../../../test-util/mock-imported-components';
import GroupList, { $imports } from '../GroupList';

describe('GroupList', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { delay } from '@hypothesis/frontend-testing';
import { mount } from 'enzyme';
import { act } from 'preact/test-utils';

import { delay } from '../../../../test-util/wait';
import GroupListItem, { $imports } from '../GroupListItem';

describe('GroupListItem', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { mockImportedComponents } from '@hypothesis/frontend-testing';
import { mount } from 'enzyme';

import { mockImportedComponents } from '../../../../test-util/mock-imported-components';
import GroupListSection, { $imports } from '../GroupListSection';

describe('GroupListSection', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import {
checkAccessibility,
mockImportedComponents,
waitForElement,
} from '@hypothesis/frontend-testing';
import { mount } from 'enzyme';

import { checkAccessibility } from '../../../../test-util/accessibility';
import { mockImportedComponents } from '../../../../test-util/mock-imported-components';
import { waitForElement } from '../../../../test-util/wait';
import * as fixtures from '../../../test/annotation-fixtures';
import ExportAnnotations, { $imports } from '../ExportAnnotations';

Expand Down
2 changes: 1 addition & 1 deletion src/sidebar/components/ShareDialog/test/FileInput-test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { checkAccessibility } from '@hypothesis/frontend-testing';
import { mount } from 'enzyme';

import { checkAccessibility } from '../../../../test-util/accessibility';
import FileInput from '../FileInput';

describe('FileInput', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import {
checkAccessibility,
waitFor,
waitForElement,
} from '@hypothesis/frontend-testing';
import { mount } from 'enzyme';

import { checkAccessibility } from '../../../../test-util/accessibility';
import { waitFor, waitForElement } from '../../../../test-util/wait';
import ImportAnnotations, { $imports } from '../ImportAnnotations';

describe('ImportAnnotations', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import {
checkAccessibility,
mockImportedComponents,
} from '@hypothesis/frontend-testing';
import { mount } from 'enzyme';

import { checkAccessibility } from '../../../../test-util/accessibility';
import { mockImportedComponents } from '../../../../test-util/mock-imported-components';
import ShareAnnotations from '../ShareAnnotations';
import { $imports } from '../ShareAnnotations';

Expand Down
6 changes: 4 additions & 2 deletions src/sidebar/components/ShareDialog/test/ShareDialog-test.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { Tab } from '@hypothesis/frontend-shared';
import {
checkAccessibility,
mockImportedComponents,
} from '@hypothesis/frontend-testing';
import { mount } from 'enzyme';

import { checkAccessibility } from '../../../../test-util/accessibility';
import { mockImportedComponents } from '../../../../test-util/mock-imported-components';
import ShareDialog from '../ShareDialog';
import { $imports } from '../ShareDialog';

Expand Down
3 changes: 1 addition & 2 deletions src/sidebar/components/test/AnnotationView-test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { mockImportedComponents, waitFor } from '@hypothesis/frontend-testing';
import { mount } from 'enzyme';

import { mockImportedComponents } from '../../../test-util/mock-imported-components';
import { waitFor } from '../../../test-util/wait';
import AnnotationView, { $imports } from '../AnnotationView';

describe('AnnotationView', () => {
Expand Down
Loading

0 comments on commit 36f918d

Please sign in to comment.