Skip to content

Commit 62dd104

Browse files
fix tests
1 parent 2b21104 commit 62dd104

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

test/integration/node-specific/bson-options/utf8_validation.test.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -167,13 +167,12 @@ describe('utf8 validation with cursors', function () {
167167
* bytes of the character 'é', to produce invalid utf8.
168168
*/
169169
async function insertDocumentWithInvalidUTF8() {
170-
const targetCharacter = Buffer.from('é').toString('hex');
171-
172170
const stub = sinon.stub(net.Socket.prototype, 'write').callsFake(function (...args) {
173171
const providedBuffer = args[0].toString('hex');
174-
const targetCharacter = Buffer.from('é').toString('hex');
175-
if (providedBuffer.includes(targetCharacter)) {
176-
if (providedBuffer.split(targetCharacter).length !== 2) {
172+
const targetBytes = Buffer.from('é').toString('hex');
173+
174+
if (providedBuffer.includes(targetBytes)) {
175+
if (providedBuffer.split(targetBytes).length !== 2) {
177176
throw new Error('received buffer more than one `c3a9` sequences. or perhaps none?');
178177
}
179178
const buffer = Buffer.from(providedBuffer.replace('c3a9', 'c301'), 'hex');
@@ -186,7 +185,7 @@ describe('utf8 validation with cursors', function () {
186185
});
187186

188187
const document = {
189-
field: targetCharacter
188+
field: 'é'
190189
};
191190

192191
await collection.insertOne(document);

0 commit comments

Comments
 (0)