@toa.io/userland 1.0.0-alpha.31 → 1.0.0-alpha.310

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.
Files changed (59) hide show
  1. package/CHANGELOG.md +189 -0
  2. package/example/components/echo/manifest.toa.yaml +15 -5
  3. package/example/components/echo/operations/get.js +1 -5
  4. package/example/components/echo/operations/resolve.js +1 -5
  5. package/example/components/echo/operations/signal.js +3 -7
  6. package/example/components/math.calculations/manifest.toa.yaml +19 -6
  7. package/example/components/math.calculations/operations/add.js +1 -5
  8. package/example/components/math.calculations/operations/increment.js +1 -5
  9. package/example/components/math.proxy/manifest.toa.yaml +8 -3
  10. package/example/components/math.proxy/operations/add.js +1 -5
  11. package/example/components/tea.pots/manifest.toa.yaml +29 -9
  12. package/example/components/tea.pots/operations/same.js +1 -5
  13. package/example/components/tea.pots/receivers/store.orders.created.js +1 -5
  14. package/example/components/web/manifest.toa.yaml +2 -4
  15. package/example/components/web/operations/get.js +3 -8
  16. package/example/context.toa.yaml +2 -7
  17. package/example/stage/call.test.js +17 -10
  18. package/example/stage/events.test.js +63 -16
  19. package/example/stage/invoke.test.js +12 -9
  20. package/package.json +18 -13
  21. package/stage/package.json +1 -0
  22. package/stage/src/component.js +3 -12
  23. package/stage/src/composition.js +3 -11
  24. package/stage/src/index.js +9 -18
  25. package/stage/src/manifest.js +2 -6
  26. package/stage/src/map.js +15 -0
  27. package/stage/src/quiescence.js +16 -0
  28. package/stage/src/remote.js +11 -8
  29. package/stage/src/service.js +11 -10
  30. package/stage/src/shutdown.js +16 -8
  31. package/stage/src/state.js +2 -4
  32. package/stage/src/workload.js +55 -0
  33. package/stage/test/boot.mock.js +10 -11
  34. package/stage/test/component.test.js +20 -10
  35. package/stage/test/composition.test.js +11 -20
  36. package/stage/test/manifest.test.js +15 -8
  37. package/stage/test/remote.test.js +14 -12
  38. package/stage/test/shutdown.test.js +26 -22
  39. package/stage/test/state.mock.js +5 -6
  40. package/stage/test/state.test.js +13 -12
  41. package/stage/types/index.d.ts +20 -9
  42. package/stage/types/state.d.ts +3 -4
  43. package/stage/src/binding/binding.js +0 -50
  44. package/stage/src/binding/consumer.js +0 -32
  45. package/stage/src/binding/emitter.js +0 -27
  46. package/stage/src/binding/factory.js +0 -49
  47. package/stage/src/binding/index.js +0 -10
  48. package/stage/src/binding/label.js +0 -12
  49. package/stage/src/binding/producer.js +0 -43
  50. package/stage/src/binding/receiver.js +0 -34
  51. package/stage/test/binding/binding.test.js +0 -15
  52. package/stage/test/binding/consumer.test.js +0 -52
  53. package/stage/test/binding/emitter.test.js +0 -78
  54. package/stage/test/binding/producer.fixtures.js +0 -10
  55. package/stage/test/binding/producer.test.js +0 -49
  56. package/stage/test/binding/receiver.fixtures.js +0 -7
  57. package/stage/test/binding/receiver.test.js +0 -54
  58. package/stage/test/binding.mock.js +0 -8
  59. package/stage/types/binding.d.ts +0 -20
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "@toa.io/userland",
3
- "version": "1.0.0-alpha.31",
3
+ "version": "1.0.0-alpha.310",
4
+ "type": "module",
4
5
  "description": "Toa development kit",
5
6
  "homepage": "https://toa.io",
6
7
  "author": {
@@ -16,23 +17,27 @@
16
17
  "url": "https://github.com/toa-io/toa/issues"
17
18
  },
18
19
  "engines": {
19
- "node": ">= 18.0.0"
20
+ "node": ">= 24.0.0"
20
21
  },
21
22
  "publishConfig": {
22
23
  "access": "public"
23
24
  },
24
25
  "main": "src/index.js",
25
- "types": "types/index.d.ts",
26
+ "exports": {
27
+ ".": "./src/index.js",
28
+ "./stage": {
29
+ "types": "./stage/types/index.d.ts",
30
+ "default": "./stage/src/index.js"
31
+ },
32
+ "./package.json": "./package.json"
33
+ },
26
34
  "dependencies": {
27
- "@toa.io/boot": "1.0.0-alpha.31",
28
- "@toa.io/core": "1.0.0-alpha.31",
29
- "@toa.io/filesystem": "1.0.0-alpha.31",
30
- "@toa.io/generic": "1.0.0-alpha.31",
31
- "@toa.io/norm": "1.0.0-alpha.31",
32
- "@toa.io/schemas": "1.0.0-alpha.31",
33
- "@toa.io/storages.null": "0.22.0",
34
- "@toa.io/yaml": "1.0.0-alpha.31",
35
- "tap": "16.3.4"
35
+ "@toa.io/boot": "1.0.0-alpha.310",
36
+ "@toa.io/core": "1.0.0-alpha.310",
37
+ "@toa.io/generic": "1.0.0-alpha.310",
38
+ "@toa.io/norm": "1.0.0-alpha.310",
39
+ "@toa.io/schemas": "1.0.0-alpha.310",
40
+ "@toa.io/storages.null": "1.0.0-alpha.310"
36
41
  },
37
- "gitHead": "91839a488176853a0731f49abc70dc7103ed7cca"
42
+ "gitHead": "d952c57f77279729e26d52d50c6df47138ad0a4f"
38
43
  }
@@ -1,4 +1,5 @@
1
1
  {
2
+ "type": "module",
2
3
  "private": true,
3
4
  "main": "src/index.js",
4
5
  "types": "types/index.d.ts"
@@ -1,12 +1,8 @@
1
- 'use strict'
2
-
3
- const boot = require('@toa.io/boot')
4
- const { state } = require('./state')
1
+ import * as boot from '@toa.io/boot'
2
+ import { state } from './state.js'
5
3
 
6
4
  /** @type {toa.stage.Component} */
7
- const component = async (path, options) => {
8
- options = Object.assign({}, DEFAULTS, options)
9
-
5
+ export const component = async (path, options) => {
10
6
  const manifest = await boot.manifest(path, options)
11
7
  const component = await boot.component(manifest)
12
8
 
@@ -16,8 +12,3 @@ const component = async (path, options) => {
16
12
 
17
13
  return component
18
14
  }
19
-
20
- const binding = require.resolve('./binding')
21
- const DEFAULTS = { bindings: [binding] }
22
-
23
- exports.component = component
@@ -1,19 +1,11 @@
1
- 'use strict'
2
-
3
- const boot = require('@toa.io/boot')
4
- const { state } = require('./state')
5
-
6
- const binding = require.resolve('./binding')
1
+ import * as boot from '@toa.io/boot'
2
+ import { state } from './state.js'
7
3
 
8
4
  /** @type {toa.stage.Composition} */
9
- const composition = async (paths, options) => {
10
- options ??= { bindings: [binding] }
11
-
5
+ export const composition = async (paths, options) => {
12
6
  const composition = await boot.composition(paths, options)
13
7
 
14
8
  await composition.connect()
15
9
 
16
10
  state.compositions.push(composition)
17
11
  }
18
-
19
- exports.composition = composition
@@ -1,18 +1,9 @@
1
- 'use strict'
2
-
3
- const { manifest } = require('./manifest')
4
- const { component } = require('./component')
5
- const { composition } = require('./composition')
6
- const { service } = require('./service')
7
- const { remote } = require('./remote')
8
- const { shutdown } = require('./shutdown')
9
- const binding = require('./binding')
10
-
11
- exports.manifest = manifest
12
- exports.component = component
13
- exports.composition = composition
14
- exports.compose = composition
15
- exports.serve = service
16
- exports.remote = remote
17
- exports.shutdown = shutdown
18
- exports.binding = binding
1
+ export { manifest } from './manifest.js'
2
+ export { map } from './map.js'
3
+ export { component } from './component.js'
4
+ export { composition, composition as compose } from './composition.js'
5
+ export { workload } from './workload.js'
6
+ export { service as serve } from './service.js'
7
+ export { remote } from './remote.js'
8
+ export { halt, restore } from './quiescence.js'
9
+ export { shutdown } from './shutdown.js'
@@ -1,12 +1,8 @@
1
- 'use strict'
2
-
3
- const boot = require('@toa.io/boot')
1
+ import * as boot from '@toa.io/boot'
4
2
 
5
3
  /**
6
4
  * @type {toa.stage.Manifest}
7
5
  */
8
- const manifest = async (path) => {
6
+ export const manifest = async (path) => {
9
7
  return boot.manifest(path)
10
8
  }
11
-
12
- exports.manifest = manifest
@@ -0,0 +1,15 @@
1
+ import * as boot from '@toa.io/boot'
2
+
3
+ /**
4
+ * What this process is given about the components it calls: the contract of the version each of
5
+ * them runs.
6
+ *
7
+ * A composition staged here is given none unless a test states one, and a component the map
8
+ * states nothing of is asked what it provides — which is what a run outside a deployment gets.
9
+ *
10
+ * @param {Record<string, import('@toa.io/core').Contract> | undefined} contracts
11
+ * @returns {void}
12
+ */
13
+ export const map = (contracts) => {
14
+ boot.map.use(contracts)
15
+ }
@@ -0,0 +1,16 @@
1
+ import { state } from './state.js'
2
+
3
+ /**
4
+ * Stops what everything staged does of its own accord, holding every connection open — what a
5
+ * process does when it is told to go quiet. A component's `stop` run command runs here.
6
+ */
7
+ export const halt = async () => {
8
+ for (const composition of state.compositions) await composition.halt()
9
+ for (const workload of state.workloads) await workload.halt()
10
+ }
11
+
12
+ /** Starts it again, running the `resume` command. */
13
+ export const restore = async () => {
14
+ for (const composition of state.compositions) await composition.restore()
15
+ for (const workload of state.workloads) await workload.restore()
16
+ }
@@ -1,19 +1,17 @@
1
- 'use strict'
1
+ import * as boot from '@toa.io/boot'
2
+ import { Locator } from '@toa.io/core'
2
3
 
3
- const boot = require('@toa.io/boot')
4
- const { Locator } = require('@toa.io/core')
5
-
6
- const { state } = require('./state')
4
+ import { state } from './state.js'
7
5
 
8
6
  /** @type {toa.stage.Remote} */
9
- const remote = async (id) => {
7
+ export const remote = async (id) => {
10
8
  const segments = id.split('.')
11
9
 
12
10
  if (segments.length === 1) segments.unshift('default')
13
11
 
14
12
  const [namespace, name] = segments
15
13
  const locator = new Locator(name, namespace)
16
- const remote = await boot.remote(locator)
14
+ const remote = await boot.remote(locator, SOURCE)
17
15
 
18
16
  await remote.connect()
19
17
 
@@ -22,4 +20,9 @@ const remote = async (id) => {
22
20
  return remote
23
21
  }
24
22
 
25
- exports.remote = remote
23
+ /**
24
+ * A feature suite calls components the way a service does, so it says so: without this
25
+ * every call it makes is attributed to an unidentified origin, and a test run leaves
26
+ * `unknown` on the application's map.
27
+ */
28
+ const SOURCE = { service: 'features' }
@@ -1,14 +1,17 @@
1
- 'use strict'
1
+ import { createRequire } from 'node:module'
2
+ import { pathToFileURL } from 'node:url'
3
+ import * as boot from '@toa.io/boot'
4
+ import { state } from './state.js'
5
+ import { shortcuts } from '@toa.io/norm'
2
6
 
3
- const boot = require('@toa.io/boot')
4
- const { state } = require('./state')
5
- const { shortcuts } = require('@toa.io/norm')
7
+ // a shortcut resolves to a package name, which is not a path
8
+ const require = createRequire(import.meta.url)
6
9
 
7
- const service = async (ref) => {
10
+ export const service = async (ref) => {
8
11
  const path = shortcuts.resolve(ref)
9
- const { Factory } = require(path)
10
- const factory = new Factory(boot)
11
- const service = factory.service()
12
+ const { Factory } = await import(pathToFileURL(require.resolve(path)).href)
13
+ const factory = new Factory(boot.host())
14
+ const service = await factory.service()
12
15
 
13
16
  await service.connect()
14
17
 
@@ -16,5 +19,3 @@ const service = async (ref) => {
16
19
 
17
20
  return service
18
21
  }
19
-
20
- exports.service = service
@@ -1,20 +1,28 @@
1
- 'use strict'
1
+ import * as boot from '@toa.io/boot'
2
2
 
3
- const { state } = require('./state')
4
- const { binding } = require('./binding')
3
+ import { state } from './state.js'
4
+ import { map } from './map.js'
5
5
 
6
6
  /** @type {toa.stage.Shutdown} */
7
- const shutdown = async () => {
7
+ export const shutdown = async () => {
8
8
  const components = state.components.map((component) => component.disconnect())
9
9
  const compositions = state.compositions.map((composition) => composition.disconnect())
10
+ const workloads = state.workloads.map((workload) => workload.disconnect())
10
11
  const services = state.services.map((service) => service.disconnect())
11
12
  const remotes = state.remotes.map((remote) => remote.disconnect())
12
- const disconnections = [...components, ...compositions, ...services, ...remotes]
13
+ const disconnections = [
14
+ ...components,
15
+ ...compositions,
16
+ ...workloads,
17
+ ...services,
18
+ ...remotes
19
+ ]
13
20
 
14
21
  await Promise.all(disconnections)
15
22
 
23
+ // whatever a test stated is not carried into the next one, and what it composed is gone
24
+ map(undefined)
25
+ boot.map.forget()
26
+
16
27
  state.reset()
17
- binding.reset()
18
28
  }
19
-
20
- exports.shutdown = shutdown
@@ -1,12 +1,11 @@
1
- 'use strict'
2
-
3
- const state = {}
1
+ export const state = {}
4
2
 
5
3
  const reset = () => {
6
4
  Object.assign(state, {
7
5
  reset,
8
6
  components: [],
9
7
  compositions: [],
8
+ workloads: [],
10
9
  remotes: [],
11
10
  services: []
12
11
  })
@@ -15,4 +14,3 @@ const reset = () => {
15
14
  reset()
16
15
 
17
16
  /** @type {toa.stage.State} */
18
- exports.state = state
@@ -0,0 +1,55 @@
1
+ import { createRequire } from 'node:module'
2
+ import { pathToFileURL } from 'node:url'
3
+ import * as boot from '@toa.io/boot'
4
+ import { Connector } from '@toa.io/core'
5
+ import { shortcuts } from '@toa.io/norm'
6
+ import { state } from './state.js'
7
+
8
+ // a shortcut resolves to a package name, which is not a path
9
+ const require = createRequire(import.meta.url)
10
+
11
+ /** The services, made against this process rather than against no process. */
12
+ const create = async (references, workload) => {
13
+ const services = []
14
+
15
+ for (const reference of references) {
16
+ const path = shortcuts.resolve(reference)
17
+ const { Factory } = await import(pathToFileURL(require.resolve(path)).href)
18
+ const service = await new Factory(boot.host(workload)).service()
19
+
20
+ if (service !== null) services.push(service)
21
+ }
22
+
23
+ return services
24
+ }
25
+
26
+ /**
27
+ * A process, as `toa compose` runs one: the composition behind a gate, whatever services it
28
+ * was told to run beside it, and whatever the extensions keep in a process — the readiness
29
+ * probe, the ear a halt arrives at.
30
+ *
31
+ * `composition` is the other way to boot the same components, and the difference is the point
32
+ * of this one: what belongs to a process is here and not there. So is what a halt takes,
33
+ * which is why a service that has to be halted is run from here rather than staged apart.
34
+ */
35
+ export const workload = async (paths, options, services = []) => {
36
+ const workload = new boot.Workload(async (workload) => {
37
+ const composition = workload.gate(
38
+ async () => await boot.composition(paths, options)
39
+ )
40
+
41
+ if (services.length === 0) return composition
42
+
43
+ const root = new Connector()
44
+
45
+ root.depends([composition, ...(await create(services, workload))])
46
+
47
+ return root
48
+ })
49
+
50
+ await workload.connect()
51
+
52
+ state.workloads.push(workload)
53
+
54
+ return workload
55
+ }
@@ -1,16 +1,15 @@
1
- 'use strict'
1
+ import { mock } from 'node:test'
2
2
 
3
- const { generate } = require('randomstring')
3
+ import { generate } from 'randomstring'
4
4
 
5
5
  const connector = () => ({
6
- connect: jest.fn(),
7
- disconnect: jest.fn(),
8
- link: jest.fn()
6
+ connect: mock.fn(),
7
+ disconnect: mock.fn(),
8
+ link: mock.fn()
9
9
  })
10
10
 
11
- const manifest = jest.fn(async () => generate())
12
- const component = jest.fn(async () => connector())
13
- const composition = jest.fn(async () => connector())
14
- const remote = jest.fn(async () => connector())
15
-
16
- module.exports = { manifest, component, composition, remote }
11
+ export const map = { use: mock.fn(), forget: mock.fn() }
12
+ export const manifest = mock.fn(async () => generate())
13
+ export const component = mock.fn(async () => connector())
14
+ export const composition = mock.fn(async () => connector())
15
+ export const remote = mock.fn(async () => connector())
@@ -1,25 +1,35 @@
1
- 'use strict'
1
+ import { it, mock as mocking } from 'node:test'
2
+ import assert from 'node:assert/strict'
3
+ import { isDeepStrictEqual } from 'node:util'
2
4
 
3
- const { generate } = require('randomstring')
5
+ import { generate } from 'randomstring'
6
+ import * as _boot from './boot.mock.js'
4
7
 
5
8
  const mock = {
6
- boot: require('./boot.mock')
9
+ boot: _boot
7
10
  }
8
11
 
9
- jest.mock('@toa.io/boot', () => mock.boot)
12
+ mocking.module('@toa.io/boot', { namedExports: mock.boot })
10
13
 
11
- const stage = require('../')
14
+ const stage = await import('../src/index.js')
12
15
 
13
16
  it('should be', () => {
14
- expect(stage.component).toBeDefined()
17
+ assert.notStrictEqual(stage.component, undefined)
15
18
  })
16
19
 
17
20
  it('should boot component', async () => {
18
21
  const path = generate()
19
22
  const component = await stage.component(path)
20
23
 
21
- expect(mock.boot.manifest.mock.calls[0][0]).toStrictEqual(path)
22
- expect(mock.boot.component).toHaveBeenCalledWith(await mock.boot.manifest.mock.results[0].value)
23
- expect(component).toStrictEqual(await mock.boot.component.mock.results[0].value)
24
- expect(component.connect).toHaveBeenCalled()
24
+ assert.deepStrictEqual(mock.boot.manifest.mock.calls[0].arguments[0], path)
25
+ const manifest = await mock.boot.manifest.mock.calls[0].result
26
+
27
+ assert.ok(
28
+ mock.boot.component.mock.calls.some(
29
+ (call) =>
30
+ call.arguments.length === 1 && isDeepStrictEqual(call.arguments[0], manifest)
31
+ )
32
+ )
33
+ assert.deepStrictEqual(component, await mock.boot.component.mock.calls[0].result)
34
+ assert.ok(component.connect.mock.callCount() > 0)
25
35
  })
@@ -1,38 +1,29 @@
1
- 'use strict'
1
+ import { it, mock as mocking } from 'node:test'
2
+ import assert from 'node:assert/strict'
2
3
 
3
- const { generate } = require('randomstring')
4
+ import { generate } from 'randomstring'
5
+ import * as _boot from './boot.mock.js'
4
6
 
5
7
  const mock = {
6
- boot: require('./boot.mock')
8
+ boot: _boot
7
9
  }
8
10
 
9
- jest.mock('@toa.io/boot', () => mock.boot)
11
+ mocking.module('@toa.io/boot', { namedExports: mock.boot })
10
12
 
11
- const stage = require('../')
13
+ const stage = await import('../src/index.js')
12
14
 
13
15
  const paths = [generate(), generate()]
14
16
 
15
17
  it('should be', () => {
16
- expect(stage.composition).toBeDefined()
18
+ assert.notStrictEqual(stage.composition, undefined)
17
19
  })
18
20
 
19
21
  it('should boot composition', async () => {
20
22
  await stage.composition(paths)
21
23
 
22
- expect(mock.boot.composition.mock.calls[0][0]).toStrictEqual(paths)
24
+ assert.deepStrictEqual(mock.boot.composition.mock.calls[0].arguments[0], paths)
23
25
 
24
- const composition = await mock.boot.composition.mock.results[0].value
26
+ const composition = await mock.boot.composition.mock.calls[0].result
25
27
 
26
- expect(composition.connect).toHaveBeenCalled()
27
- })
28
-
29
- it('should override bindings', async () => {
30
- await stage.composition(paths)
31
-
32
- const path = require.resolve('../src/binding')
33
-
34
- /** @type {toa.boot.composition.Options} */
35
- const options = { bindings: [path] }
36
-
37
- expect(mock.boot.composition.mock.calls[0][1]).toStrictEqual(options)
28
+ assert.ok(composition.connect.mock.callCount() > 0)
38
29
  })
@@ -1,17 +1,20 @@
1
- 'use strict'
1
+ import { it, mock as mocking } from 'node:test'
2
+ import assert from 'node:assert/strict'
3
+ import { isDeepStrictEqual } from 'node:util'
2
4
 
3
- const { generate } = require('randomstring')
5
+ import { generate } from 'randomstring'
6
+ import * as _boot from './boot.mock.js'
4
7
 
5
8
  const mock = {
6
- boot: require('./boot.mock')
9
+ boot: _boot
7
10
  }
8
11
 
9
- jest.mock('@toa.io/boot', () => mock.boot)
12
+ mocking.module('@toa.io/boot', { namedExports: mock.boot })
10
13
 
11
- const stage = require('../')
14
+ const stage = await import('../src/index.js')
12
15
 
13
16
  it('should be', () => {
14
- expect(stage.manifest).toBeDefined()
17
+ assert.notStrictEqual(stage.manifest, undefined)
15
18
  })
16
19
 
17
20
  it('should boot manifest', async () => {
@@ -19,6 +22,10 @@ it('should boot manifest', async () => {
19
22
 
20
23
  const manifest = await stage.manifest(path)
21
24
 
22
- expect(mock.boot.manifest).toHaveBeenCalledWith(path)
23
- expect(manifest).toStrictEqual(await mock.boot.manifest.mock.results[0].value)
25
+ assert.ok(
26
+ mock.boot.manifest.mock.calls.some(
27
+ (call) => call.arguments.length === 1 && isDeepStrictEqual(call.arguments[0], path)
28
+ )
29
+ )
30
+ assert.deepStrictEqual(manifest, await mock.boot.manifest.mock.calls[0].result)
24
31
  })
@@ -1,17 +1,19 @@
1
- 'use strict'
1
+ import { it, mock as mocking } from 'node:test'
2
+ import assert from 'node:assert/strict'
2
3
 
3
- const { generate } = require('randomstring')
4
+ import { generate } from 'randomstring'
5
+ import * as _boot from './boot.mock.js'
4
6
 
5
7
  const mock = {
6
- boot: require('./boot.mock')
8
+ boot: _boot
7
9
  }
8
10
 
9
- jest.mock('@toa.io/boot', () => mock.boot)
11
+ mocking.module('@toa.io/boot', { namedExports: mock.boot })
10
12
 
11
- const stage = require('../')
13
+ const stage = await import('../src/index.js')
12
14
 
13
15
  it('should be', () => {
14
- expect(stage.remote).toBeDefined()
16
+ assert.notStrictEqual(stage.remote, undefined)
15
17
  })
16
18
 
17
19
  it('should connect remote', async () => {
@@ -21,12 +23,12 @@ it('should connect remote', async () => {
21
23
 
22
24
  const remote = await stage.remote(id)
23
25
 
24
- expect(mock.boot.remote).toHaveBeenCalled()
25
- expect(remote).toStrictEqual(await mock.boot.remote.mock.results[0].value)
26
- expect(remote.connect).toHaveBeenCalled()
26
+ assert.ok(mock.boot.remote.mock.callCount() > 0)
27
+ assert.deepStrictEqual(remote, await mock.boot.remote.mock.calls[0].result)
28
+ assert.ok(remote.connect.mock.callCount() > 0)
27
29
 
28
- const locator = mock.boot.remote.mock.calls[0][0]
30
+ const locator = mock.boot.remote.mock.calls[0].arguments[0]
29
31
 
30
- expect(locator).toBeDefined()
31
- expect(locator).toMatchObject({ name, namespace })
32
+ assert.notStrictEqual(locator, undefined)
33
+ assert.partialDeepStrictEqual(locator, { name, namespace })
32
34
  })