Skip to content

Commit d2e856e

Browse files
authored
test(NODE-7165): migrate integration/bson-decimal128 tests (mongodb#4670)
1 parent e8a91a9 commit d2e856e

File tree

2 files changed

+31
-38
lines changed

2 files changed

+31
-38
lines changed

test/integration/bson-decimal128/decimal128.test.js

Lines changed: 0 additions & 38 deletions
This file was deleted.
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import { expect } from 'chai';
2+
3+
import { type Collection, Decimal128, type MongoClient } from '../../../src';
4+
5+
describe('Decimal128', function () {
6+
let client: MongoClient;
7+
let collection: Collection;
8+
9+
beforeEach(async function () {
10+
client = this.configuration.newClient();
11+
collection = client.db('decimal128').collection('decimal128');
12+
});
13+
14+
afterEach(async function () {
15+
await client.close();
16+
});
17+
18+
it('should correctly insert decimal128 value', async function () {
19+
const object = {
20+
id: 1,
21+
value: Decimal128.fromString('1.28')
22+
};
23+
await collection.insertOne(object);
24+
const doc = await collection.findOne({
25+
id: 1
26+
});
27+
28+
expect(doc.value).to.be.instanceof(Decimal128);
29+
expect(doc.value.toString()).to.equal('1.28');
30+
});
31+
});

0 commit comments

Comments
 (0)