@mongosh/browser-runtime-electron 5.1.0 → 5.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mongosh/browser-runtime-electron",
3
- "version": "5.1.0",
3
+ "version": "5.3.2",
4
4
  "description": "Mongosh browser runtime electron",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -40,16 +40,16 @@
40
40
  "@mongodb-js/eslint-config-mongosh": "^1.0.0",
41
41
  "@mongodb-js/prettier-config-devtools": "^1.0.1",
42
42
  "@mongodb-js/tsconfig-mongosh": "^1.0.0",
43
- "@mongosh/service-provider-node-driver": "^5.0.2",
43
+ "@mongosh/service-provider-node-driver": "^5.0.6",
44
44
  "bson": "^7.2.0",
45
45
  "eslint": "^7.25.0",
46
46
  "prettier": "^2.8.8",
47
47
  "rimraf": "^3.0.2"
48
48
  },
49
49
  "dependencies": {
50
- "@mongosh/browser-runtime-core": "^5.1.0",
51
- "@mongosh/service-provider-core": "5.0.1",
52
- "@mongosh/types": "^5.0.1"
50
+ "@mongosh/browser-runtime-core": "^5.3.2",
51
+ "@mongosh/service-provider-core": "5.0.3",
52
+ "@mongosh/types": "^5.0.3"
53
53
  },
54
- "gitHead": "281d2607b3fab2fe6d5d5e88f7fbb051a111297d"
54
+ "gitHead": "8046da7b463930861417f6b414580823af71889f"
55
55
  }
@@ -10,6 +10,8 @@ import * as bson from 'bson';
10
10
  import { ElectronRuntime } from './electron-runtime';
11
11
  import { EventEmitter } from 'events';
12
12
  import type { RuntimeEvaluationListener } from '@mongosh/browser-runtime-core';
13
+ import { stubInterface } from 'ts-sinon';
14
+ import type { ServiceProviderFindCursor } from '@mongosh/service-provider-core';
13
15
 
14
16
  describe('Electron runtime', function () {
15
17
  let serviceProvider: SinonStubbedInstance<NodeDriverServiceProvider>;
@@ -75,6 +77,21 @@ describe('Electron runtime', function () {
75
77
  expect(result.type).to.equal('ShowCollectionsResult');
76
78
  });
77
79
 
80
+ it('can run db.test.find()', async function () {
81
+ const mockFindCursor = stubInterface<ServiceProviderFindCursor>();
82
+ const findStub = sinon.stub().returns(mockFindCursor);
83
+ (serviceProvider as any).find = findStub;
84
+ const result = await electronRuntime.evaluate('db.test.find().limit(10)');
85
+ expect(result.constructionOptions).to.deep.equal({
86
+ options: {
87
+ cursorType: 'Cursor',
88
+ method: 'find',
89
+ args: ['test', 'test', undefined, {}],
90
+ },
91
+ chains: [{ method: 'limit', args: [10] }],
92
+ });
93
+ });
94
+
78
95
  it('allows to use require', async function () {
79
96
  const result = await electronRuntime.evaluate(
80
97
  'require("util").types.isDate(new Date())'