@universal-packages/workflows-jest 1.0.1 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. package/index.js +21 -5
  2. package/index.js.map +1 -1
  3. package/package.json +1 -1
package/index.js CHANGED
@@ -1,8 +1,12 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  const globals_1 = require("@jest/globals");
4
7
  const sub_process_1 = require("@universal-packages/sub-process");
5
8
  const workflows_1 = require("@universal-packages/workflows");
9
+ const events_1 = __importDefault(require("events"));
6
10
  require("./globals");
7
11
  const WORKFLOWS_JEST = {
8
12
  mocked: false,
@@ -33,12 +37,24 @@ global.workflowsJest = {
33
37
  },
34
38
  mockRuns: () => {
35
39
  WORKFLOWS_JEST.mocked = true;
40
+ class MockedWorkflow extends events_1.default {
41
+ get graph() {
42
+ return {
43
+ name: this.name,
44
+ routines: []
45
+ };
46
+ }
47
+ constructor(name, options) {
48
+ super();
49
+ this.name = name;
50
+ this.options = options;
51
+ }
52
+ run() {
53
+ WORKFLOWS_JEST.ranMockedWorkflows.push({ name: this.name, options: this.options });
54
+ }
55
+ }
36
56
  workflows_1.Workflow.buildFrom = (name, options) => {
37
- return {
38
- run: () => {
39
- WORKFLOWS_JEST.ranMockedWorkflows.push({ name, options });
40
- }
41
- };
57
+ return new MockedWorkflow(name, options);
42
58
  };
43
59
  }
44
60
  };
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AAAA,2CAAsC;AACtC,iEAA4D;AAC5D,6DAAkF;AAElF,qBAAkB;AAElB,MAAM,cAAc,GAAG;IACrB,MAAM,EAAE,KAAK;IACb,kBAAkB,EAAE,EAAE;CACvB,CAAA;AAED,MAAM,CAAC,aAAa,GAAG;IACrB,GAAG,EAAE,KAAK,EAAE,IAAY,E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,SAAS,CAAC,uCAAuC;gBAC7J,IAAI;aACL,CAAA;SACF;aAAM;YACL,OAAO;gBACL,OAAO,EAAE,GAAG,EAAE,CAAC,aAAa,QAAQ,+CAA+C,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,SAAS,CAAC,kBAAkB;gBACxI,IAAI;aACL,CAAA;SACF;KACF;AACH,CAAC;AAED,gBAAM,CAAC,MAAM,CAAC;IACZ,sBAAsB;IACtB,qBAAqB;IACrB,kCAAkC;CACnC,CAAC,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@universal-packages/workflows-jest",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "Jest matchers for universal workflows",
5
5
  "author": "David De Anda <david@universal-packages.com> (https://github.com/universal-packages)",
6
6
  "license": "MIT",