Skip to content

Commit

Permalink
Move test-utils into a directory (#2236)
Browse files Browse the repository at this point in the history
* move test-utils.js into directory

Signed-off-by: Kerry Archibald <kerrya@element.io>

* fix imports

Signed-off-by: Kerry Archibald <kerrya@element.io>
  • Loading branch information
Kerry authored Mar 14, 2022
1 parent d064d82 commit 57d71cc
Show file tree
Hide file tree
Showing 25 changed files with 27 additions and 27 deletions.
2 changes: 1 addition & 1 deletion spec/TestClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import MockHttpBackend from 'matrix-mock-request';
import { LocalStorageCryptoStore } from '../src/crypto/store/localStorage-crypto-store';
import { logger } from '../src/logger';
import { WebStorageSessionStore } from "../src/store/session/webstorage";
import { syncPromise } from "./test-utils";
import { syncPromise } from "./test-utils/test-utils";
import { createClient } from "../src/matrix";
import { MockStorageApi } from "./MockStorageApi";

Expand Down
2 changes: 1 addition & 1 deletion spec/browserify/sync-browserify.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ limitations under the License.
// load XmlHttpRequest mock
import "./setupTests";
import "../../dist/browser-matrix"; // uses browser-matrix instead of the src
import * as utils from "../test-utils";
import * as utils from "../test-utils/test-utils";
import { TestClient } from "../TestClient";

const USER_ID = "@user:test.server";
Expand Down
2 changes: 1 addition & 1 deletion spec/integ/devicelist-integ-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ limitations under the License.
*/

import { TestClient } from '../TestClient';
import * as testUtils from '../test-utils';
import * as testUtils from '../test-utils/test-utils';
import { logger } from '../../src/logger';

const ROOM_ID = "!room:id";
Expand Down
2 changes: 1 addition & 1 deletion spec/integ/matrix-client-crypto.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ limitations under the License.
import '../olm-loader';

import { logger } from '../../src/logger';
import * as testUtils from "../test-utils";
import * as testUtils from "../test-utils/test-utils";
import { TestClient } from "../TestClient";
import { CRYPTO_ENABLED } from "../../src/client";

Expand Down
2 changes: 1 addition & 1 deletion spec/integ/matrix-client-event-emitter.spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as utils from "../test-utils";
import * as utils from "../test-utils/test-utils";
import { TestClient } from "../TestClient";

describe("MatrixClient events", function() {
Expand Down
2 changes: 1 addition & 1 deletion spec/integ/matrix-client-event-timeline.spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as utils from "../test-utils";
import * as utils from "../test-utils/test-utils";
import { EventTimeline } from "../../src/matrix";
import { logger } from "../../src/logger";
import { TestClient } from "../TestClient";
Expand Down
2 changes: 1 addition & 1 deletion spec/integ/matrix-client-methods.spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as utils from "../test-utils";
import * as utils from "../test-utils/test-utils";
import { CRYPTO_ENABLED } from "../../src/client";
import { MatrixEvent } from "../../src/models/event";
import { Filter, MemoryStore, Room } from "../../src/matrix";
Expand Down
2 changes: 1 addition & 1 deletion spec/integ/matrix-client-opts.spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import HttpBackend from "matrix-mock-request";

import * as utils from "../test-utils";
import * as utils from "../test-utils/test-utils";
import { MatrixClient } from "../../src/matrix";
import { MatrixScheduler } from "../../src/scheduler";
import { MemoryStore } from "../../src/store/memory";
Expand Down
2 changes: 1 addition & 1 deletion spec/integ/matrix-client-room-timeline.spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as utils from "../test-utils";
import * as utils from "../test-utils/test-utils";
import { EventStatus } from "../../src/models/event";
import { TestClient } from "../TestClient";

Expand Down
2 changes: 1 addition & 1 deletion spec/integ/matrix-client-syncing.spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { MatrixEvent } from "../../src/models/event";
import { EventTimeline } from "../../src/models/event-timeline";
import * as utils from "../test-utils";
import * as utils from "../test-utils/test-utils";
import { TestClient } from "../TestClient";

describe("MatrixClient syncing", function() {
Expand Down
2 changes: 1 addition & 1 deletion spec/integ/megolm-integ.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ limitations under the License.

import anotherjson from "another-json";

import * as testUtils from "../test-utils";
import * as testUtils from "../test-utils/test-utils";
import { TestClient } from "../TestClient";
import { logger } from "../../src/logger";

Expand Down
6 changes: 3 additions & 3 deletions spec/test-utils.js → spec/test-utils/test-utils.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// load olm before the sdk if possible
import './olm-loader';
import '../olm-loader';

import { logger } from '../src/logger';
import { MatrixEvent } from "../src/models/event";
import { logger } from '../../src/logger';
import { MatrixEvent } from "../../src/models/event";

/**
* Return a promise that is resolved when the client next emits a
Expand Down
2 changes: 1 addition & 1 deletion spec/unit/crypto/algorithms/megolm.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import '../../../olm-loader';
import * as algorithms from "../../../../src/crypto/algorithms";
import { MemoryCryptoStore } from "../../../../src/crypto/store/memory-crypto-store";
import { MockStorageApi } from "../../../MockStorageApi";
import * as testUtils from "../../../test-utils";
import * as testUtils from "../../../test-utils/test-utils";
import { OlmDevice } from "../../../../src/crypto/OlmDevice";
import { Crypto } from "../../../../src/crypto";
import { logger } from "../../../../src/logger";
Expand Down
2 changes: 1 addition & 1 deletion spec/unit/crypto/backup.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import * as algorithms from "../../../src/crypto/algorithms";
import { WebStorageSessionStore } from "../../../src/store/session/webstorage";
import { MemoryCryptoStore } from "../../../src/crypto/store/memory-crypto-store";
import { MockStorageApi } from "../../MockStorageApi";
import * as testUtils from "../../test-utils";
import * as testUtils from "../../test-utils/test-utils";
import { OlmDevice } from "../../../src/crypto/OlmDevice";
import { Crypto } from "../../../src/crypto";
import { resetCrossSigningKeys } from "./crypto-utils";
Expand Down
2 changes: 1 addition & 1 deletion spec/unit/crypto/cross-signing.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import anotherjson from 'another-json';

import * as olmlib from "../../../src/crypto/olmlib";
import { TestClient } from '../../TestClient';
import { HttpResponse, setHttpResponses } from '../../test-utils';
import { HttpResponse, setHttpResponses } from '../../test-utils/test-utils';
import { resetCrossSigningKeys } from "./crypto-utils";
import { MatrixError } from '../../../src/http-api';
import { logger } from '../../../src/logger';
Expand Down
2 changes: 1 addition & 1 deletion spec/unit/event-timeline.spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as utils from "../test-utils";
import * as utils from "../test-utils/test-utils";
import { EventTimeline } from "../../src/models/event-timeline";
import { RoomState } from "../../src/models/room-state";

Expand Down
2 changes: 1 addition & 1 deletion spec/unit/filter-component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {
RelationType,
} from "../../src";
import { FilterComponent } from "../../src/filter-component";
import { mkEvent } from '../test-utils';
import { mkEvent } from '../test-utils/test-utils';

describe("Filter Component", function() {
describe("types", function() {
Expand Down
2 changes: 1 addition & 1 deletion spec/unit/matrix-client.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
import { MEGOLM_ALGORITHM } from "../../src/crypto/olmlib";
import { EventStatus, MatrixEvent } from "../../src/models/event";
import { Preset } from "../../src/@types/partials";
import * as testUtils from "../test-utils";
import * as testUtils from "../test-utils/test-utils";

jest.useFakeTimers();

Expand Down
2 changes: 1 addition & 1 deletion spec/unit/pushprocessor.spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as utils from "../test-utils";
import * as utils from "../test-utils/test-utils";
import { PushProcessor } from "../../src/pushprocessor";

describe('NotificationService', function() {
Expand Down
2 changes: 1 addition & 1 deletion spec/unit/room-member.spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as utils from "../test-utils";
import * as utils from "../test-utils/test-utils";
import { RoomMember } from "../../src/models/room-member";

describe("RoomMember", function() {
Expand Down
2 changes: 1 addition & 1 deletion spec/unit/room-state.spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as utils from "../test-utils";
import * as utils from "../test-utils/test-utils";
import { RoomState } from "../../src/models/room-state";

describe("RoomState", function() {
Expand Down
2 changes: 1 addition & 1 deletion spec/unit/room.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ limitations under the License.
* @module client
*/

import * as utils from "../test-utils";
import * as utils from "../test-utils/test-utils";
import { DuplicateStrategy, EventStatus, MatrixEvent, PendingEventOrdering, RoomEvent } from "../../src";
import { EventTimeline } from "../../src/models/event-timeline";
import { Room } from "../../src/models/room";
Expand Down
2 changes: 1 addition & 1 deletion spec/unit/scheduler.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import { defer } from '../../src/utils';
import { MatrixError } from "../../src/http-api";
import { MatrixScheduler } from "../../src/scheduler";
import * as utils from "../test-utils";
import * as utils from "../test-utils/test-utils";

jest.useFakeTimers();

Expand Down
2 changes: 1 addition & 1 deletion spec/unit/timeline-window.spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { EventTimeline } from "../../src/models/event-timeline";
import { TimelineIndex, TimelineWindow } from "../../src/timeline-window";
import * as utils from "../test-utils";
import * as utils from "../test-utils/test-utils";

const ROOM_ID = "roomId";
const USER_ID = "userId";
Expand Down
2 changes: 1 addition & 1 deletion spec/unit/user.spec.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { User } from "../../src/models/user";
import * as utils from "../test-utils";
import * as utils from "../test-utils/test-utils";

describe("User", function() {
const userId = "@alice:bar";
Expand Down

0 comments on commit 57d71cc

Please sign in to comment.