Skip to content

Commit a195daa

Browse files
use Range instead of RangePreview
1 parent bd3ce63 commit a195daa

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

addon/mongocrypt.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -596,10 +596,10 @@ Value MongoCrypt::MakeExplicitEncryptionContext(const CallbackInfo& info) {
596596
throw TypeError::New(Env(), errorStringFromStatus(context.get()));
597597
}
598598

599-
if (strcasecmp(algorithm.c_str(), "rangepreview") == 0) {
599+
if (strcasecmp(algorithm.c_str(), "range") == 0) {
600600
if (!options.Has("rangeOptions")) {
601601
throw TypeError::New(
602-
Env(), "`rangeOptions` must be provided if `algorithm` is set to RangePreview");
602+
Env(), "`rangeOptions` must be provided if `algorithm` is set to Range");
603603
}
604604

605605
Uint8Array rangeOptions = Uint8ArrayFromValue(options["rangeOptions"], "rangeOptions");

test/bindings.test.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -341,17 +341,17 @@ describe('MongoCryptConstructor', () => {
341341
});
342342
});
343343

344-
context('when algorithm is `rangePreview', () => {
344+
context('when algorithm is `Range', () => {
345345
it('throws a TypeError if rangeOptions is not provided', () => {
346346
expect(() =>
347347
mc.makeExplicitEncryptionContext(value, {
348348
// minimum required arguments from libmongocrypt
349349
keyId: keyId.buffer,
350350
expressionMode: false,
351-
algorithm: 'rangePreview'
351+
algorithm: 'Range'
352352
})
353353
)
354-
.to.throw(/`rangeOptions` must be provided if `algorithm` is set to RangePreview/)
354+
.to.throw(/`rangeOptions` must be provided if `algorithm` is set to Range/)
355355
.to.be.instanceOf(TypeError);
356356
});
357357

@@ -361,26 +361,26 @@ describe('MongoCryptConstructor', () => {
361361
// minimum required arguments from libmongocrypt
362362
keyId: keyId.buffer,
363363
expressionMode: false,
364-
algorithm: 'rangePreview',
364+
algorithm: 'Range',
365365
rangeOptions: 'non-buffer'
366366
})
367367
)
368368
.to.throw(/Parameter `rangeOptions` must be a Uint8Array./)
369369
.to.be.instanceOf(TypeError);
370370
});
371371

372-
it('checks if `rangePreview` is set case-insensitive', () => {
372+
it('checks if `Range` is set case-insensitive', () => {
373373
expect(
374374
mc.makeExplicitEncryptionContext(value, {
375375
// minimum required arguments from libmongocrypt
376376
keyId: keyId.buffer,
377377
expressionMode: false,
378-
algorithm: 'RANGEPREVIEW',
378+
algorithm: 'RANGE',
379379
rangeOptions: serialize({
380380
sparsity: new Long(42)
381381
}),
382382

383-
// contention factor is required for `rangePreview` but
383+
// contention factor is required for `Range` but
384384
// is enforced in libmongocrypt, not our bindings
385385
contentionFactor: 2
386386
})

0 commit comments

Comments
 (0)