Repository: ViacomInc/data-point
Pull request #408 (2019-08-29 20:24:51)

feat(data-point): remove type from Reducer
<!--
Thanks for your interest in the project. We appreciate bugs filed and PRs submitted!

Please make sure that you are familiar with and follow the Code of Conduct for
this project (found in the CODE_OF_CONDUCT.md file).

Also, please make sure you're familiar with and follow the instructions in the
contributing guidelines (found in the CONTRIBUTING.md file).

Please fill out the information below to expedite the review and (hopefully)
merge of your pull request!

BREAKING CHANGES:

If your PR includes a breaking change, please submit it with a codemod under
data-point-codemods that will help users upgrade their codebase.

Breaking changes without a codemod will not be accepted unless a codemod is not
viable or does not apply to the specific situation.
-->

<!-- What changes are being made? (What feature/bug is being fixed here?) -->
**What**:

Removes the `type` property from the Reducer and all of its extensions.

**BREAKING CHANGE**: Reducer no longer receives a type argument, we now rely on the class
`constructor.name`. Reducer id changed the format to `{reducer.name}:{this.constructor.name}` to follow a more common typing notation where first is the name then the type. 

<!-- Why are these changes necessary? -->
**Why**:

Because it does not make sense to have a type when we can check against `instanceof` or we can check the constructor.name to get the most accurate name of the reducer. 

**This change simplifies the codebase**

<!-- How were these changes implemented? -->
**How**:

<!-- Have you done all of these things?  -->
**Checklist**:
<!-- add "N/A" to the end of each line that's irrelevant to your changes -->
<!-- to check an item, place an "x" in the box like so: "- [x] Documentation" -->
- [ ] Has Breaking changes
- [ ] Documentation
- [X] Tests
- [X] Ready to be merged <!-- In your opinion, is this ready to be merged as soon as it's reviewed? -->
- [ ] Added username to **all-contributors** list

<!-- feel free to add additional comments -->

codecov[bot]: # [Codecov](https://codecov.io/gh/ViacomInc/data-point/pull/408?src=pr&el=h1) Report
> Merging [#408](https://codecov.io/gh/ViacomInc/data-point/pull/408?src=pr&el=desc) into [canary](https://codecov.io/gh/ViacomInc/data-point/commit/b4b9a63d5bb4415900f8ab71ddc5ab0c97743a91?src=pr&el=desc) will **not change** coverage.
> The diff coverage is `100%`.

[![Impacted file tree graph](https://codecov.io/gh/ViacomInc/data-point/pull/408/graphs/tree.svg?width=650&token=LYxItnrx4i&height=150&src=pr)](https://codecov.io/gh/ViacomInc/data-point/pull/408?src=pr&el=tree)

```diff
@@          Coverage Diff          @@
##           canary   #408   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files          24     23    -1     
  Lines         388    381    -7     
  Branches       57     56    -1     
=====================================
- Hits          388    381    -7
```


| [Impacted Files](https://codecov.io/gh/ViacomInc/data-point/pull/408?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [...es/data-point/src/reducer-helpers/assign/assign.js](https://codecov.io/gh/ViacomInc/data-point/pull/408/diff?src=pr&el=tree#diff-cGFja2FnZXMvZGF0YS1wb2ludC9zcmMvcmVkdWNlci1oZWxwZXJzL2Fzc2lnbi9hc3NpZ24uanM=) | `100% <100%> (ø)` | :arrow_up: |
| [packages/data-point/src/reducer-helpers/map/map.js](https://codecov.io/gh/ViacomInc/data-point/pull/408/diff?src=pr&el=tree#diff-cGFja2FnZXMvZGF0YS1wb2ludC9zcmMvcmVkdWNlci1oZWxwZXJzL21hcC9tYXAuanM=) | `100% <100%> (ø)` | :arrow_up: |
| [packages/data-point/src/ReducerPath.js](https://codecov.io/gh/ViacomInc/data-point/pull/408/diff?src=pr&el=tree#diff-cGFja2FnZXMvZGF0YS1wb2ludC9zcmMvUmVkdWNlclBhdGguanM=) | `100% <100%> (ø)` | :arrow_up: |
| [packages/data-point/src/ReducerObject.js](https://codecov.io/gh/ViacomInc/data-point/pull/408/diff?src=pr&el=tree#diff-cGFja2FnZXMvZGF0YS1wb2ludC9zcmMvUmVkdWNlck9iamVjdC5qcw==) | `100% <100%> (ø)` | :arrow_up: |
| [packages/data-point/src/ReducerEntity.js](https://codecov.io/gh/ViacomInc/data-point/pull/408/diff?src=pr&el=tree#diff-cGFja2FnZXMvZGF0YS1wb2ludC9zcmMvUmVkdWNlckVudGl0eS5qcw==) | `100% <100%> (ø)` | :arrow_up: |
| [...ata-point/src/reducer-helpers/parallel/parallel.js](https://codecov.io/gh/ViacomInc/data-point/pull/408/diff?src=pr&el=tree#diff-cGFja2FnZXMvZGF0YS1wb2ludC9zcmMvcmVkdWNlci1oZWxwZXJzL3BhcmFsbGVsL3BhcmFsbGVsLmpz) | `100% <100%> (ø)` | :arrow_up: |
| [packages/data-point/src/Reducer.js](https://codecov.io/gh/ViacomInc/data-point/pull/408/diff?src=pr&el=tree#diff-cGFja2FnZXMvZGF0YS1wb2ludC9zcmMvUmVkdWNlci5qcw==) | `100% <100%> (ø)` | :arrow_up: |
| [...ata-point/src/reducer-helpers/constant/constant.js](https://codecov.io/gh/ViacomInc/data-point/pull/408/diff?src=pr&el=tree#diff-cGFja2FnZXMvZGF0YS1wb2ludC9zcmMvcmVkdWNlci1oZWxwZXJzL2NvbnN0YW50L2NvbnN0YW50Lmpz) | `100% <100%> (ø)` | :arrow_up: |
| [...t/src/reducer-helpers/if-then-else/if-then-else.js](https://codecov.io/gh/ViacomInc/data-point/pull/408/diff?src=pr&el=tree#diff-cGFja2FnZXMvZGF0YS1wb2ludC9zcmMvcmVkdWNlci1oZWxwZXJzL2lmLXRoZW4tZWxzZS9pZi10aGVuLWVsc2UuanM=) | `100% <100%> (ø)` | :arrow_up: |
| [...es/data-point/src/reducer-helpers/select/select.js](https://codecov.io/gh/ViacomInc/data-point/pull/408/diff?src=pr&el=tree#diff-cGFja2FnZXMvZGF0YS1wb2ludC9zcmMvcmVkdWNlci1oZWxwZXJzL3NlbGVjdC9zZWxlY3QuanM=) | `100% <100%> (ø)` | :arrow_up: |
| ... and [2 more](https://codecov.io/gh/ViacomInc/data-point/pull/408/diff?src=pr&el=tree-more) | |

------

[Continue to review full report at Codecov](https://codecov.io/gh/ViacomInc/data-point/pull/408?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/ViacomInc/data-point/pull/408?src=pr&el=footer). Last update [b4b9a63...f245add](https://codecov.io/gh/ViacomInc/data-point/pull/408?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).


Patch:
diff --git a/packages/data-point/src/Reducer.js b/packages/data-point/src/Reducer.js
index 4fc7b05..9352d52 100644
--- a/packages/data-point/src/Reducer.js
+++ b/packages/data-point/src/Reducer.js
@@ -1,18 +1,13 @@
 const { IS_REDUCER } = require("./reducer-symbols");
-const uniqueIdScope = require("./unique-id-scope");
-
-const uniqueId = uniqueIdScope();
 
 function normalizeName(name) {
-  const reducerUId = uniqueId();
-  return name ? `${name}:${reducerUId}` : reducerUId;
+  return name ? `${name}:` : "";
 }
 
 class Reducer {
-  constructor(type, name, spec) {
-    this.id = `${type}:${normalizeName(name)}`;
+  constructor(name, spec) {
+    this.id = `${normalizeName(name)}${this.constructor.name}`;
     this.name = name;
-    this.type = type;
 
     Object.defineProperty(this, "spec", {
       value: spec,
diff --git a/packages/data-point/src/ReducerEntity.js b/packages/data-point/src/ReducerEntity.js
index 5fca7aa..6c9fdc1 100644
--- a/packages/data-point/src/ReducerEntity.js
+++ b/packages/data-point/src/ReducerEntity.js
@@ -2,8 +2,8 @@ const { createReducer } = require("./create-reducer");
 const { Reducer } = require("./Reducer");
 
 class ReducerEntity extends Reducer {
-  constructor(type, spec) {
-    super(type, spec.name, spec);
+  constructor(spec) {
+    super(spec.name, spec);
 
     this.uid = spec.uid;
     this.params = spec.params || {};
diff --git a/packages/data-point/src/ReducerFunction.js b/packages/data-point/src/ReducerFunction.js
index d5141da..b4c0d7d 100644
--- a/packages/data-point/src/ReducerFunction.js
+++ b/packages/data-point/src/ReducerFunction.js
@@ -2,7 +2,7 @@ const { Reducer } = require("./Reducer");
 
 class ReducerFunction extends Reducer {
   constructor(spec) {
-    super("function", spec.name || "anonymous", spec);
+    super(spec.name || "anonymous", spec);
 
     this.functionBody = spec;
   }
diff --git a/packages/data-point/src/ReducerList.js b/packages/data-point/src/ReducerList.js
index b3a27d5..3870c65 100644
--- a/packages/data-point/src/ReducerList.js
+++ b/packages/data-point/src/ReducerList.js
@@ -2,7 +2,7 @@ const { Reducer } = require("./Reducer");
 
 class ReducerList extends Reducer {
   constructor(spec, createReducer) {
-    super("list", undefined, spec);
+    super(undefined, spec);
 
     this.reducerList = spec.map(reducerSource => createReducer(reducerSource));
   }
diff --git a/packages/data-point/src/ReducerObject.js b/packages/data-point/src/ReducerObject.js
index cc6e76d..8cef618 100644
--- a/packages/data-point/src/ReducerObject.js
+++ b/packages/data-point/src/ReducerObject.js
@@ -2,7 +2,7 @@ const set = require("lodash/set");
 const cloneDeep = require("lodash/cloneDeep");
 
 const { Reducer } = require("./Reducer");
-const isReducerConstant = require("./is-reducer-constant");
+const { ReducerConstant } = require("./reducer-helpers/constant/constant");
 const isPlainObject = require("./is-plain-object");
 
 function newProps() {
@@ -30,7 +30,7 @@ function getObjectProperties(
     const path = stack.concat(key);
     const value = source[key];
 
-    if (isReducerConstant(value)) {
+    if (value instanceof ReducerConstant) {
       set(props.constant, path, value.constantValue);
       return;
     }
@@ -50,7 +50,7 @@ function getObjectProperties(
 
 class ReducerObject extends Reducer {
   constructor(spec, createReducer) {
-    super("object", undefined, spec);
+    super(undefined, spec);
 
     this.objectProperties = getObjectProperties(createReducer, spec);
   }
diff --git a/packages/data-point/src/ReducerPath.js b/packages/data-point/src/ReducerPath.js
index 0f14bb8..421708a 100644
--- a/packages/data-point/src/ReducerPath.js
+++ b/packages/data-point/src/ReducerPath.js
@@ -125,7 +125,7 @@ class ReducerPath extends Reducer {
    * @param {string} spec dot notation object path, expects path to start with $
    */
   constructor(spec) {
-    super("path", spec, spec);
+    super(spec, spec);
     this.compiledPath = parsePath(spec);
   }
 
diff --git a/packages/data-point/src/is-reducer-constant.js b/packages/data-point/src/is-reducer-constant.js
deleted file mode 100644
index b131a23..0000000
--- a/packages/data-point/src/is-reducer-constant.js
+++ /dev/null
@@ -1,7 +0,0 @@
-const { Reducer } = require("./Reducer");
-
-function isReducerConstant(value) {
-  return Reducer.isReducer(value) && value.type === "constant";
-}
-
-module.exports = isReducerConstant;
diff --git a/packages/data-point/src/reducer-entities/model/model.js b/packages/data-point/src/reducer-entities/model/model.js
index e133fc6..480d11b 100644
--- a/packages/data-point/src/reducer-entities/model/model.js
+++ b/packages/data-point/src/reducer-entities/model/model.js
@@ -1,10 +1,6 @@
 const { ReducerEntity } = require("../../ReducerEntity");
 
 class ReducerModel extends ReducerEntity {
-  constructor(spec) {
-    super("model", spec);
-  }
-
   static create(spec) {
     return new ReducerModel(spec);
   }
diff --git a/packages/data-point/src/reducer-helpers/assign/assign.js b/packages/data-point/src/reducer-helpers/assign/assign.js
index 4344531..2dc0f6b 100644
--- a/packages/data-point/src/reducer-helpers/assign/assign.js
+++ b/packages/data-point/src/reducer-helpers/assign/assign.js
@@ -3,7 +3,7 @@ const { createReducer } = require("../../create-reducer");
 
 class ReducerAssign extends Reducer {
   constructor(spec) {
-    super("assign", undefined, spec);
+    super(undefined, spec);
     this.assignReducer = createReducer(spec);
   }
 
diff --git a/packages/data-point/src/reducer-helpers/constant/constant.js b/packages/data-point/src/reducer-helpers/constant/constant.js
index 7688752..9f2ca85 100644
--- a/packages/data-point/src/reducer-helpers/constant/constant.js
+++ b/packages/data-point/src/reducer-helpers/constant/constant.js
@@ -13,7 +13,7 @@ function cloneObject(isObject, value) {
 
 class ReducerConstant extends Reducer {
   constructor(spec) {
-    super("constant", undefined, spec);
+    super(undefined, spec);
     this.isPlainObject = isPlainObject(spec);
     // We clone the source to truly respect the nature of a constant, if the
     // original source is ever changed the data integrity of the constant
diff --git a/packages/data-point/src/reducer-helpers/if-then-else/if-then-else.js b/packages/data-point/src/reducer-helpers/if-then-else/if-then-else.js
index c41c4f0..c6a3079 100644
--- a/packages/data-point/src/reducer-helpers/if-then-else/if-then-else.js
+++ b/packages/data-point/src/reducer-helpers/if-then-else/if-then-else.js
@@ -17,7 +17,7 @@ function parseIfElse(spec) {
 
 class ReducerIfThenElse extends Reducer {
   constructor(spec) {
-    super("ifThenElse", undefined, spec);
+    super(undefined, spec);
     this.statement = parseIfElse(spec);
   }
 
diff --git a/packages/data-point/src/reducer-helpers/map/map.js b/packages/data-point/src/reducer-helpers/map/map.js
index 42b4637..7bc4bc0 100644
--- a/packages/data-point/src/reducer-helpers/map/map.js
+++ b/packages/data-point/src/reducer-helpers/map/map.js
@@ -7,7 +7,7 @@ const { createReducer } = require("../../create-reducer");
  */
 class ReducerMap extends Reducer {
   constructor(spec) {
-    super("map", undefined, spec);
+    super(undefined, spec);
 
     /**
      * @type {Reducer} Iteratee used to run thru each value in the
diff --git a/packages/data-point/src/reducer-helpers/parallel/parallel.js b/packages/data-point/src/reducer-helpers/parallel/parallel.js
index bc1cd10..156b466 100644
--- a/packages/data-point/src/reducer-helpers/parallel/parallel.js
+++ b/packages/data-point/src/reducer-helpers/parallel/parallel.js
@@ -6,7 +6,7 @@ const { createReducer } = require("../../create-reducer");
  */
 class ReducerParallel extends Reducer {
   constructor(spec) {
-    super("parallel", undefined, spec);
+    super(undefined, spec);
 
     /**
      * @type {Reducer[]} list of reducers to run in parallel against a
diff --git a/packages/data-point/src/reducer-helpers/select/select.js b/packages/data-point/src/reducer-helpers/select/select.js
index f37c35c..2d21b0c 100644
--- a/packages/data-point/src/reducer-helpers/select/select.js
+++ b/packages/data-point/src/reducer-helpers/select/select.js
@@ -94,7 +94,7 @@ async function getMatchingCaseStatement(caseStatements, acc, resolveReducer) {
  */
 class ReducerSelect extends Reducer {
   constructor(spec) {
-    super("select", undefined, spec);
+    super(undefined, spec);
     validate(spec);
     this.select = parseSelect(spec);
   }


Test patch:
diff --git a/packages/data-point/src/Reducer.test.js b/packages/data-point/src/Reducer.test.js
index b6d27ae..3b1c34b 100644
--- a/packages/data-point/src/Reducer.test.js
+++ b/packages/data-point/src/Reducer.test.js
@@ -1,21 +1,13 @@
-jest.mock("./unique-id-scope", () => {
-  return () => () => "uniqueId";
-});
-
 const { Reducer, normalizeName } = require("./Reducer");
 const { IS_REDUCER } = require("./reducer-symbols");
 
 function createReducer() {
-  return new Reducer("type", "name", "spec");
+  return new Reducer("name", "spec");
 }
 
 describe("normalizeName", () => {
-  it("should append if provided", () => {
-    expect(normalizeName("name")).toEqual("name:uniqueId");
-  });
-
-  it("should only return unique id value if name is not provided", () => {
-    expect(normalizeName()).toEqual("uniqueId");
+  it("should add postfix", () => {
+    expect(normalizeName("name")).toEqual("name:");
   });
 });
 
@@ -24,7 +16,6 @@ describe("Reducer", () => {
     it("should set type name and spec", () => {
       const reducer = createReducer();
       expect(reducer).toMatchObject({
-        type: "type",
         name: "name",
         spec: "spec"
       });
diff --git a/packages/data-point/src/ReducerEntity.test.js b/packages/data-point/src/ReducerEntity.test.js
index 4de8b2a..6020f30 100644
--- a/packages/data-point/src/ReducerEntity.test.js
+++ b/packages/data-point/src/ReducerEntity.test.js
@@ -56,7 +56,7 @@ describe("ReducerEntity", () => {
       params: true
     };
     function createEntity() {
-      return new ReducerEntity("type", {
+      return new ReducerEntity({
         uid,
         name: "customEntity",
         value: () => "value",
@@ -78,7 +78,7 @@ describe("ReducerEntity", () => {
     });
 
     it("should set default params to empty object", () => {
-      const entity = new ReducerEntity("type", {});
+      const entity = new ReducerEntity({});
       expect(entity).toHaveProperty("params", {});
     });
 
@@ -99,7 +99,7 @@ describe("ReducerEntity", () => {
 
   describe("resolveReducer", () => {
     it("should resolve entityValue", async () => {
-      const entity = new ReducerEntity("type", {
+      const entity = new ReducerEntity({
         name: "customEntity",
         value: "value"
       });
@@ -119,7 +119,7 @@ describe("ReducerEntity", () => {
 
     describe("handle resolveEntityValue throwing an error", () => {
       it("should throw augmented error if this.catch is not set", async () => {
-        const entity = new ReducerEntity("type", {
+        const entity = new ReducerEntity({
           name: "customEntity",
           value: () => "value"
         });
@@ -143,7 +143,7 @@ describe("ReducerEntity", () => {
       });
 
       it("should resolve this.catch", async () => {
-        const entity = new ReducerEntity("type", {
+        const entity = new ReducerEntity({
           name: "customEntity",
           value: () => "value",
           catch: () => "catch"
@@ -163,7 +163,7 @@ describe("ReducerEntity", () => {
       });
 
       it("should check output type of this.catch resolved value for data integrity", async () => {
-        const entity = new ReducerEntity("type", {
+        const entity = new ReducerEntity({
           name: "customEntity",
           value: () => "value",
           catch: () => "catch",
@@ -184,7 +184,7 @@ describe("ReducerEntity", () => {
       });
 
       it("should not handle error if catch fails", async () => {
-        const entity = new ReducerEntity("type", {
+        const entity = new ReducerEntity({
           name: "customEntity",
           value: () => "value",
           catch: () => {
@@ -208,7 +208,7 @@ describe("ReducerEntity", () => {
       });
 
       it("should not handle error if outputType fails", async () => {
-        const entity = new ReducerEntity("type", {
+        const entity = new ReducerEntity({
           name: "customEntity",
           value: () => "value",
           catch: () => "catch",
@@ -236,7 +236,7 @@ describe("ReducerEntity", () => {
 
   describe("resolveEntityValue", () => {
     it("should return value if no reducers are set", async () => {
-      const entity = new ReducerEntity("type", {
+      const entity = new ReducerEntity({
         name: "customEntity"
       });
 
@@ -250,7 +250,7 @@ describe("ReducerEntity", () => {
 
     it("should execute inputType but not mutate result", async () => {
       const inputType = jest.fn(() => "inputType");
-      const entity = new ReducerEntity("type", {
+      const entity = new ReducerEntity({
         name: "customEntity",
         inputType
       });
@@ -267,7 +267,7 @@ describe("ReducerEntity", () => {
     describe("cache", () => {
       it("should skip cache if cache.get is not a function", async () => {
         const mockBefore = jest.fn(value => value);
-        const entity = new ReducerEntity("type", {
+        const entity = new ReducerEntity({
           name: "customEntity",
           before: mockBefore
         });
@@ -288,7 +288,7 @@ describe("ReducerEntity", () => {
 
       it("should call this.uid when assigned", async () => {
         const mockUid = jest.fn(() => "uid");
-        const entity = new ReducerEntity("type", {
+        const entity = new ReducerEntity({
           uid: mockUid,
           name: "customEntity"
         });
@@ -305,7 +305,7 @@ describe("ReducerEntity", () => {
         const mockUid = jest.fn(() => "uid");
         const mockBefore = jest.fn(value => value);
 
-        const entity = new ReducerEntity("type", {
+        const entity = new ReducerEntity({
           uid: mockUid,
           name: "customEntity",
           before: mockBefore
@@ -328,7 +328,7 @@ describe("ReducerEntity", () => {
 
       it("should ignore cache result if cache.get returns undefined", async () => {
         const mockBefore = jest.fn(value => value);
-        const entity = new ReducerEntity("type", {
+        const entity = new ReducerEntity({
           name: "customEntity",
           before: mockBefore
         });
@@ -348,7 +348,7 @@ describe("ReducerEntity", () => {
       });
 
       it("should call cache.set if cache.set is set, and cache.get() misses", async () => {
-        const entity = new ReducerEntity("type", {
+        const entity = new ReducerEntity({
           name: "customEntity"
         });
 
@@ -369,7 +369,7 @@ describe("ReducerEntity", () => {
     });
 
     it("should resolve and return value of this.before reducer", async () => {
-      const entity = new ReducerEntity("type", {
+      const entity = new ReducerEntity({
         name: "customEntity",
         before: value => `${value}:before`
       });
@@ -383,7 +383,7 @@ describe("ReducerEntity", () => {
     });
 
     it("should resolve and return value of this.value reducer", async () => {
-      const entity = new ReducerEntity("type", {
+      const entity = new ReducerEntity({
         name: "customEntity",
         value: value => `${value}:value`
       });
@@ -397,7 +397,7 @@ describe("ReducerEntity", () => {
     });
 
     it("should resolve and return value of this.after reducer", async () => {
-      const entity = new ReducerEntity("type", {
+      const entity = new ReducerEntity({
         name: "customEntity",
         after: value => `${value}:after`
       });
@@ -412,7 +412,7 @@ describe("ReducerEntity", () => {
 
     it("should execute outputType but not mutate result", async () => {
       const outputType = jest.fn(() => "outputType");
-      const entity = new ReducerEntity("type", {
+      const entity = new ReducerEntity({
         name: "customEntity",
         outputType
       });
@@ -428,7 +428,7 @@ describe("ReducerEntity", () => {
 
     it("should execute this.resolve (if set) and return value", async () => {
       const outputType = jest.fn(() => "outputType");
-      const entity = new ReducerEntity("type", {
+      const entity = new ReducerEntity({
         name: "customEntity",
         outputType
       });
@@ -450,7 +450,7 @@ describe("ReducerEntity", () => {
         tracker.push(reducer(acc.value, acc));
       });
 
-      const entity = new ReducerEntity("type", {
+      const entity = new ReducerEntity({
         name: "customEntity",
         inputType: () => "inputType",
         before: () => "before",
diff --git a/packages/data-point/src/ReducerFunction.test.js b/packages/data-point/src/ReducerFunction.test.js
index 49482e1..cfd776e 100644
--- a/packages/data-point/src/ReducerFunction.test.js
+++ b/packages/data-point/src/ReducerFunction.test.js
@@ -19,11 +19,6 @@ describe("ReducerFunction", () => {
       const result = new ReducerFunction(() => true);
       expect(result.name).toEqual("anonymous");
     });
-
-    it("should set reducer's type to 'function'", () => {
-      const result = new ReducerFunction(fn);
-      expect(result.type).toEqual("function");
-    });
   });
 
   describe("isType", () => {
diff --git a/packages/data-point/src/ReducerList.test.js b/packages/data-point/src/ReducerList.test.js
index e35dd84..7a842a7 100644
--- a/packages/data-point/src/ReducerList.test.js
+++ b/packages/data-point/src/ReducerList.test.js
@@ -21,11 +21,6 @@ describe("ReducerList", () => {
   describe("constructor", () => {
     const overSimplifiedCreateReducer = source => source;
 
-    it("should set type to list", () => {
-      const reducer = new ReducerList([], overSimplifiedCreateReducer);
-      expect(reducer.type).toEqual("list");
-    });
-
     it("should have no name defined", () => {
       const reducer = new ReducerList([], overSimplifiedCreateReducer);
       expect(reducer.name).toEqual(undefined);
diff --git a/packages/data-point/src/ReducerObject.test.js b/packages/data-point/src/ReducerObject.test.js
index 4c0f479..f192063 100644
--- a/packages/data-point/src/ReducerObject.test.js
+++ b/packages/data-point/src/ReducerObject.test.js
@@ -134,11 +134,6 @@ describe("getObjectProperties", () => {
 describe("ReducerObject", () => {
   const { ReducerObject } = reducerObject;
   describe("constructor", () => {
-    it("should set type to list", () => {
-      const reducer = new ReducerObject({}, mockCreateReducer);
-      expect(reducer.type).toEqual("object");
-    });
-
     it("should have no name defined", () => {
       const reducer = new ReducerObject({}, mockCreateReducer);
       expect(reducer.name).toEqual(undefined);
diff --git a/packages/data-point/src/ReducerPath.test.js b/packages/data-point/src/ReducerPath.test.js
index 06435f5..3eda813 100644
--- a/packages/data-point/src/ReducerPath.test.js
+++ b/packages/data-point/src/ReducerPath.test.js
@@ -185,11 +185,6 @@ describe("ReducerPath", () => {
       const result = new ReducerPath(pathSrc);
       expect(result.name).toEqual(pathSrc);
     });
-
-    it("should set reducer's type to 'function'", () => {
-      const result = new ReducerPath(pathSrc);
-      expect(result.type).toEqual("path");
-    });
   });
 
   describe("isType", () => {
diff --git a/packages/data-point/src/create-reducer.test.js b/packages/data-point/src/create-reducer.test.js
index e55ee7d..abdc5bd 100644
--- a/packages/data-point/src/create-reducer.test.js
+++ b/packages/data-point/src/create-reducer.test.js
@@ -29,21 +29,21 @@ describe("createReducer/getReducer", () => {
 
   it("should create function reducer", () => {
     const reducer = createReducer.createReducer(() => true);
-    expect(reducer).toHaveProperty("type", "function");
+    expect(reducer.constructor.name).toEqual("ReducerFunction");
   });
 
   it("should create path reducer", () => {
     const reducer = createReducer.createReducer("$a[7]");
-    expect(reducer).toHaveProperty("type", "path");
+    expect(reducer.constructor.name).toEqual("ReducerPath");
   });
 
   it("should create list reducer", () => {
     const reducer = createReducer.createReducer([]);
-    expect(reducer).toHaveProperty("type", "list");
+    expect(reducer.constructor.name).toEqual("ReducerList");
   });
 
   it("should create object reducer", () => {
     const reducer = createReducer.createReducer({});
-    expect(reducer).toHaveProperty("type", "object");
+    expect(reducer.constructor.name).toEqual("ReducerObject");
   });
 });
diff --git a/packages/data-point/src/is-reducer-constant.test.js b/packages/data-point/src/is-reducer-constant.test.js
deleted file mode 100644
index fc51a0d..0000000
--- a/packages/data-point/src/is-reducer-constant.test.js
+++ /dev/null
@@ -1,10 +0,0 @@
-const isReducerConstant = require("./is-reducer-constant");
-const { Reducer } = require("./Reducer");
-const constant = require("./reducer-helpers/constant");
-
-describe("isReducerConstant", () => {
-  it("should testName", () => {
-    expect(isReducerConstant(constant(true))).toEqual(true);
-    expect(isReducerConstant(new Reducer())).toEqual(false);
-  });
-});
diff --git a/packages/data-point/src/reducer-helpers/assign/assign.test.js b/packages/data-point/src/reducer-helpers/assign/assign.test.js
index 8425dad..2170875 100644
--- a/packages/data-point/src/reducer-helpers/assign/assign.test.js
+++ b/packages/data-point/src/reducer-helpers/assign/assign.test.js
@@ -1,17 +1,13 @@
 const { ReducerAssign } = require("./assign");
 const { Accumulator } = require("../../Accumulator");
 const { resolve } = require("../../resolve");
+const { ReducerObject } = require("../../ReducerObject");
 
 describe("ReducerAssign", () => {
   describe("constructor", () => {
-    it("should set type to 'assign'", () => {
-      const reducer = new ReducerAssign({});
-      expect(reducer.type).toEqual("assign");
-    });
-
     it("should create a reducer from spec and assign to assignReducer", () => {
       const reducer = new ReducerAssign({});
-      expect(reducer.assignReducer).toHaveProperty("type", "object");
+      expect(reducer.assignReducer).toBeInstanceOf(ReducerObject);
     });
   });
 
diff --git a/packages/data-point/src/reducer-helpers/constant/constant.test.js b/packages/data-point/src/reducer-helpers/constant/constant.test.js
index c47266e..8a3fe5f 100644
--- a/packages/data-point/src/reducer-helpers/constant/constant.test.js
+++ b/packages/data-point/src/reducer-helpers/constant/constant.test.js
@@ -27,11 +27,6 @@ describe("cloneObject", () => {
 
 describe("ReducerConstant", () => {
   describe("constructor", () => {
-    it("should set type to 'constant'", () => {
-      const reducer = new ReducerConstant("value");
-      expect(reducer.type).toEqual("constant");
-    });
-
     it("should set constantValue to source received", () => {
       const reducer = new ReducerConstant("value");
       expect(reducer.constantValue).toEqual("value");
@@ -62,7 +57,6 @@ describe("ReducerConstant", () => {
   describe("create", () => {
     it("should create new instance", () => {
       const reducer = ReducerConstant.create("value");
-      expect(reducer.type).toEqual("constant");
       expect(reducer.constantValue).toEqual("value");
     });
   });
diff --git a/packages/data-point/src/reducer-helpers/if-then-else/if-then-else.test.js b/packages/data-point/src/reducer-helpers/if-then-else/if-then-else.test.js
index a5e88dc..6317b2b 100644
--- a/packages/data-point/src/reducer-helpers/if-then-else/if-then-else.test.js
+++ b/packages/data-point/src/reducer-helpers/if-then-else/if-then-else.test.js
@@ -1,4 +1,5 @@
 const { ReducerIfThenElse } = require("./if-then-else");
+const { Reducer } = require("../../Reducer");
 const { Accumulator } = require("../../Accumulator");
 const { resolve } = require("../../resolve");
 
@@ -10,16 +11,11 @@ describe("ReducerIfThenElse", () => {
   };
 
   describe("constructor", () => {
-    it("should set type to 'ifThenElse'", () => {
-      const reducer = new ReducerIfThenElse(spec);
-      expect(reducer.type).toEqual("ifThenElse");
-    });
-
     it("should store reducer entries from spec", () => {
       const reducer = new ReducerIfThenElse(spec);
-      expect(reducer.statement).toHaveProperty("if.type", "function");
-      expect(reducer.statement).toHaveProperty("then.type", "function");
-      expect(reducer.statement).toHaveProperty("else.type", "function");
+      expect(reducer.statement.if).toBeInstanceOf(Reducer);
+      expect(reducer.statement.then).toBeInstanceOf(Reducer);
+      expect(reducer.statement.else).toBeInstanceOf(Reducer);
     });
   });
 
diff --git a/packages/data-point/src/reducer-helpers/map/map.test.js b/packages/data-point/src/reducer-helpers/map/map.test.js
index 0898d3b..a122c43 100644
--- a/packages/data-point/src/reducer-helpers/map/map.test.js
+++ b/packages/data-point/src/reducer-helpers/map/map.test.js
@@ -1,19 +1,15 @@
 const { ReducerMap } = require("./map");
 const { Accumulator } = require("../../Accumulator");
 const { resolve } = require("../../resolve");
+const { Reducer } = require("../../Reducer");
 
 describe("ReducerMap", () => {
   const multiplyByTwo = value => value * 2;
 
   describe("constructor", () => {
-    it("should set type to 'map'", () => {
-      const reducer = new ReducerMap(multiplyByTwo);
-      expect(reducer.type).toEqual("map");
-    });
-
     it("should create a reducer from spec and assign to iterateeReducer", () => {
       const reducer = new ReducerMap(multiplyByTwo);
-      expect(reducer.iterateeReducer).toHaveProperty("type", "function");
+      expect(reducer.iterateeReducer).toBeInstanceOf(Reducer);
     });
   });
 
diff --git a/packages/data-point/src/reducer-helpers/parallel/parallel.test.js b/packages/data-point/src/reducer-helpers/parallel/parallel.test.js
index 9219141..b665078 100644
--- a/packages/data-point/src/reducer-helpers/parallel/parallel.test.js
+++ b/packages/data-point/src/reducer-helpers/parallel/parallel.test.js
@@ -1,6 +1,7 @@
 const { ReducerParallel } = require("./parallel");
 const { Accumulator } = require("../../Accumulator");
 const { resolve } = require("../../resolve");
+const { Reducer } = require("../../Reducer");
 
 afterEach(() => {
   jest.clearAllMocks();
@@ -14,17 +15,12 @@ const parallelReducers = [multiplyByTwo, multiplyByThree, multiplyByFour];
 
 describe("ReducerParallel", () => {
   describe("constructor", () => {
-    it("should set type to 'parallel'", () => {
-      const reducer = new ReducerParallel(parallelReducers);
-      expect(reducer.type).toEqual("parallel");
-    });
-
     it("should map and parse input source to an Array of reducers ", () => {
       const reducer = new ReducerParallel(parallelReducers);
       expect(reducer.parallelReducers).toBeInstanceOf(Array);
 
       reducer.parallelReducers.forEach(reducerItem => {
-        expect(reducerItem).toHaveProperty("type", "function");
+        expect(reducerItem).toBeInstanceOf(Reducer);
       });
     });
   });
diff --git a/packages/data-point/src/reducer-helpers/select/select.test.js b/packages/data-point/src/reducer-helpers/select/select.test.js
index d92c119..e9b2e30 100644
--- a/packages/data-point/src/reducer-helpers/select/select.test.js
+++ b/packages/data-point/src/reducer-helpers/select/select.test.js
@@ -111,11 +111,6 @@ describe("ReducerSelect", () => {
   };
 
   describe("constructor", () => {
-    it("should set type to 'select'", () => {
-      const reducer = new ReducerSelect(selectSpec);
-      expect(reducer).toHaveProperty("type", "select");
-    });
-
     it("should validate input", () => {
       // eslint-disable-next-line no-unused-vars
       const reducer = new ReducerSelect(selectSpec);