diff --git a/test/integration/bson-decimal128/decimal128.test.js b/test/integration/bson-decimal128/decimal128.test.js deleted file mode 100644 index 81b33ce6a46..00000000000 --- a/test/integration/bson-decimal128/decimal128.test.js +++ /dev/null @@ -1,38 +0,0 @@ -'use strict'; -const { assert: test } = require('../shared'); -const { expect } = require('chai'); -const { setupDatabase } = require('../shared'); -const { Decimal128 } = require('../../mongodb'); - -describe('Decimal128', function () { - before(function () { - return setupDatabase(this.configuration); - }); - - it('should correctly insert decimal128 value', function (done) { - var configuration = this.configuration; - var client = configuration.newClient(configuration.writeConcernMax(), { maxPoolSize: 1 }); - var db = client.db(configuration.db); - var object = { - id: 1, - value: Decimal128.fromString('1.28') - }; - - db.collection('decimal128').insertOne(object, function (err) { - expect(err).to.not.exist; - - db.collection('decimal128').findOne( - { - id: 1 - }, - function (err, doc) { - expect(err).to.not.exist; - test.ok(doc.value instanceof Decimal128); - test.equal('1.28', doc.value.toString()); - - client.close(done); - } - ); - }); - }); -}); diff --git a/test/integration/bson-decimal128/decimal128.test.ts b/test/integration/bson-decimal128/decimal128.test.ts new file mode 100644 index 00000000000..73e7bab69a4 --- /dev/null +++ b/test/integration/bson-decimal128/decimal128.test.ts @@ -0,0 +1,31 @@ +import { expect } from 'chai'; + +import { type Collection, Decimal128, type MongoClient } from '../../../src'; + +describe('Decimal128', function () { + let client: MongoClient; + let collection: Collection; + + beforeEach(async function () { + client = this.configuration.newClient(); + collection = client.db('decimal128').collection('decimal128'); + }); + + afterEach(async function () { + await client.close(); + }); + + it('should correctly insert decimal128 value', async function () { + const object = { + id: 1, + value: Decimal128.fromString('1.28') + }; + await collection.insertOne(object); + const doc = await collection.findOne({ + id: 1 + }); + + expect(doc.value).to.be.instanceof(Decimal128); + expect(doc.value.toString()).to.equal('1.28'); + }); +});