Skip to content

Commit a5e6a37

Browse files
removed tests for rebase, will add back in later
1 parent 0977983 commit a5e6a37

File tree

1 file changed

+0
-61
lines changed

1 file changed

+0
-61
lines changed

test/node/uuid_tests.js

Lines changed: 0 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -162,65 +162,4 @@ describe('UUID', () => {
162162
const uuid = new UUID(UPPERCASE_DASH_SEPARATED_UUID_STRING);
163163
expect(inspect(uuid)).to.equal(`new UUID("${LOWERCASE_DASH_SEPARATED_UUID_STRING}")`);
164164
});
165-
166-
describe('deserialize', () => {
167-
const originalUUID = new BSON.UUID();
168-
const binaryUUID = originalUUID.toBinary();
169-
const serializedUUID = BSON.serialize({ uuid: originalUUID.toBinary() });
170-
171-
it('should promoteUUIDs when flag is true', () => {
172-
const { uuid: promotedUUID } = BSON.deserialize(serializedUUID, { promoteUUIDs: true });
173-
expect(promotedUUID._bsontype).to.equal('UUID');
174-
expect(promotedUUID).to.deep.equal(originalUUID);
175-
});
176-
177-
it('should not promoteUUIDs when flag is false', () => {
178-
const { uuid: unpromotedUUID } = BSON.deserialize(serializedUUID, { promoteUUIDs: false });
179-
expect(unpromotedUUID._bsontype).to.equal('Binary');
180-
expect(unpromotedUUID).to.deep.equal(binaryUUID);
181-
});
182-
183-
it('should not promoteUUIDs when flag is omitted', () => {
184-
const { uuid: omittedFlagUUID } = BSON.deserialize(serializedUUID);
185-
expect(omittedFlagUUID._bsontype).to.equal('Binary');
186-
expect(omittedFlagUUID).to.deep.equal(binaryUUID);
187-
});
188-
189-
it('should throw BSONTypeError if _bsontype is not UUID and promoteUUIDs is true', () => {
190-
const binaryVar = new Binary(Buffer.from('abc'));
191-
const serializedBinary = BSON.serialize(binaryVar);
192-
expect(() => {
193-
BSON.deserialize(serializedBinary, { promoteUUIDs: true });
194-
}).to.throw(BSONTypeError);
195-
});
196-
197-
describe('promoteBuffers', () => {
198-
const promoteUUIDValues = [true, false, undefined];
199-
const promoteBufferValues = [true, false, undefined];
200-
201-
const testCases = promoteUUIDValues.flatMap(promoteUUIDs =>
202-
promoteBufferValues.flatMap(promoteBuffers => ({
203-
options: { promoteUUIDs, promoteBuffers },
204-
// promoteBuffers: true returns a Buffer so _bsontype does not exist
205-
outcome: promoteUUIDs ? 'UUID' : promoteBuffers ? undefined : 'Binary'
206-
}))
207-
);
208-
209-
for (const { options, outcome } of testCases) {
210-
it(`should deserialize to ${outcome} type when promoteUUIDs is ${options.promoteUUIDs} and promoteBuffers is ${options.promoteBuffers}`, () => {
211-
const { uuid } = BSON.deserialize(serializedUUID, options);
212-
expect(uuid._bsontype).to.equal(outcome);
213-
if (uuid._bsontype === 'UUID') {
214-
expect(uuid.id).to.deep.equal(originalUUID.id);
215-
} else if (uuid._bsontype === 'Binary') {
216-
expect(uuid.buffer).to.deep.equal(originalUUID.id);
217-
} else if (uuid._bsontype === undefined) {
218-
expect(uuid).to.deep.equal(originalUUID.id);
219-
} else {
220-
expect.fail('Unexpected _bsontype');
221-
}
222-
});
223-
}
224-
});
225-
});
226165
});

0 commit comments

Comments
 (0)