Skip to content

Commit 6bc8fe8

Browse files
committed
fix test
1 parent fb3a426 commit 6bc8fe8

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

test/all-bson-types-fixture.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,14 @@ export const allBSONTypesDoc = {
6262
dbRef: new DBRef('namespace', new ObjectId('642d76b4b7ebfab15d3c4a78')) // not actually a separate type, just a convention
6363
};
6464

65+
const {
66+
dbRef,
67+
...allValidBSONTypesDoc
68+
} = allBSONTypesDoc;
69+
6570
// Includes some edge cases like empty objects, nested empty arrays, etc.
66-
export const allBSONTypesWithEdgeCasesDoc = {
67-
...allBSONTypesDoc,
71+
export const allValidBSONTypesWithEdgeCasesDoc = {
72+
...allValidBSONTypesDoc,
6873
emptyObject: {},
6974
objectWithNestedEmpty: {
7075
nestedEmpty: {}

test/integration/generateAndValidate.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
import { MongoClient, type Db } from 'mongodb';
1010
import { mochaTestServer } from '@mongodb-js/compass-test-server';
1111

12-
import { allBSONTypesWithEdgeCasesDoc } from '../all-bson-types-fixture';
12+
import { allValidBSONTypesWithEdgeCasesDoc } from '../all-bson-types-fixture';
1313
import { analyzeDocuments } from '../../src';
1414

1515
const bsonDocuments = [{
@@ -134,8 +134,8 @@ describe('With a MongoDB Cluster', function() {
134134
const allTypesCollection = 'allTypes';
135135

136136
before(async function() {
137-
await db.collection(allTypesCollection).insertOne(allBSONTypesWithEdgeCasesDoc);
138-
const docsFromCollection = await db.collection(allTypesCollection).find().toArray();
137+
await db.collection(allTypesCollection).insertOne(allValidBSONTypesWithEdgeCasesDoc);
138+
const docsFromCollection = await db.collection(allTypesCollection).find({}, { promoteValues: false }).toArray();
139139

140140
// Create the schema validation rule.
141141
const analyzedDocuments = await analyzeDocuments(docsFromCollection);
@@ -150,12 +150,12 @@ describe('With a MongoDB Cluster', function() {
150150
});
151151
});
152152

153-
it('allows inserting valid documents (does not error)', async function() {
153+
it.only('allows inserting valid documents (does not error)', async function() {
154154
const docs = [{
155-
...allBSONTypesWithEdgeCasesDoc,
155+
...allValidBSONTypesWithEdgeCasesDoc,
156156
_id: new ObjectId()
157157
}, {
158-
...allBSONTypesWithEdgeCasesDoc,
158+
...allValidBSONTypesWithEdgeCasesDoc,
159159
_id: new ObjectId()
160160
}];
161161

0 commit comments

Comments
 (0)