Skip to content

Commit cf4086f

Browse files
committed
more tests
1 parent 1257949 commit cf4086f

File tree

4 files changed

+28
-9
lines changed

4 files changed

+28
-9
lines changed

packages/compass-crud/src/stores/crud-store.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,7 @@ describe('store', function () {
249249
dataLake: {
250250
isDataLake: false,
251251
},
252+
preferences,
252253
} as any);
253254

254255
sinon.restore();

packages/compass-schema-validation/src/stores/store.spec.ts

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,7 @@ const topologyDescription = {
3434
servers: [{ type: 'Unknown' }],
3535
};
3636

37-
const fakeInstance = new MongoDBInstance({
38-
_id: '123',
39-
topologyDescription,
40-
build: {
41-
version: '6.0.0',
42-
},
43-
} as any);
37+
let fakeInstance: MongoDBInstance;
4438

4539
const fakeDataService = {
4640
collectionInfo: () =>
@@ -61,14 +55,24 @@ const getMockedStore = async (analyzeSchema: any) => {
6155
const connectionInfoRef = {
6256
current: {},
6357
} as ConnectionInfoRef;
58+
const preferences = await createSandboxFromDefaultPreferences();
59+
60+
fakeInstance = new MongoDBInstance({
61+
_id: '123',
62+
topologyDescription,
63+
build: {
64+
version: '6.0.0',
65+
},
66+
preferences,
67+
} as any);
6468
const activateResult = onActivated(
6569
{ namespace: 'test.test' } as any,
6670
{
6771
globalAppRegistry: globalAppRegistry,
6872
dataService: fakeDataService,
6973
instance: fakeInstance,
7074
workspaces: fakeWorkspaces,
71-
preferences: await createSandboxFromDefaultPreferences(),
75+
preferences,
7276
logger: createNoopLogger(),
7377
track: createNoopTrack(),
7478
connectionInfoRef,

packages/databases-collections/src/collections-plugin.spec.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,21 @@ import {
1111
import { expect } from 'chai';
1212
import { CollectionsPlugin } from './collections-plugin';
1313
import Sinon from 'sinon';
14+
import {
15+
type PreferencesAccess,
16+
createSandboxFromDefaultPreferences,
17+
} from 'compass-preferences-model';
1418

1519
describe('Collections [Plugin]', function () {
1620
let dataService: any;
1721
let mongodbInstance: Sinon.SinonSpiedInstance<MongoDBInstance>;
1822
let appRegistry: Sinon.SinonSpiedInstance<
1923
RenderWithConnectionsResult['globalAppRegistry']
2024
>;
25+
let preferences: PreferencesAccess;
2126

22-
beforeEach(function () {
27+
beforeEach(async function () {
28+
preferences = await createSandboxFromDefaultPreferences();
2329
mongodbInstance = Sinon.spy(
2430
new MongoDBInstance({
2531
databases: [
@@ -30,6 +36,7 @@ describe('Collections [Plugin]', function () {
3036
},
3137
],
3238
topologyDescription: { type: 'ReplicaSetWithPrimary' },
39+
preferences,
3340
} as any)
3441
);
3542
for (const db of mongodbInstance.databases) {

packages/databases-collections/src/databases-plugin.spec.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,15 @@ import {
1111
import { expect } from 'chai';
1212
import { DatabasesPlugin } from './databases-plugin';
1313
import Sinon from 'sinon';
14+
import {
15+
createSandboxFromDefaultPreferences,
16+
type PreferencesAccess,
17+
} from 'compass-preferences-model';
1418

1519
describe('Databasees [Plugin]', function () {
1620
let dataService: any;
1721
let mongodbInstance: Sinon.SinonSpiedInstance<MongoDBInstance>;
22+
let preferences: PreferencesAccess;
1823
let appRegistry: Sinon.SinonSpiedInstance<
1924
RenderWithConnectionsResult['globalAppRegistry']
2025
>;
@@ -26,10 +31,12 @@ describe('Databasees [Plugin]', function () {
2631

2732
describe('with loaded databases', function () {
2833
beforeEach(async function () {
34+
preferences = await createSandboxFromDefaultPreferences();
2935
mongodbInstance = Sinon.spy(
3036
new MongoDBInstance({
3137
databases: [],
3238
topologyDescription: { type: 'ReplicaSetWithPrimary' },
39+
preferences,
3340
} as any)
3441
);
3542

0 commit comments

Comments
 (0)