Repository: ViacomInc/data-point
Pull request #291 (2018-05-27 15:03:01)

feat(data-point): base entity resolves value 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

resolve value as a Life Cycle (base entity logic) step instead of delegating its resolution to the entity type's resolve method.

<!-- Why are these changes necessary? -->
## Why

simplifies current and custom entity type authoring, it also adds a check when the `value` reducer is not present to not get executed, which results in a performance gain. 

<!-- How were these changes implemented? -->
## How

Moves value resolution to the base entity's `resolve` method, removes it from built-in entity-types

**The logic to resolve value reducer is moved to base-entity/resolve:**

<img width="1111" alt="image" src="https://user-images.githubusercontent.com/235111/40575945-8cb920ce-60bc-11e8-9075-24b1c78bb9dd.png">

**Results in simplified entity resolve methods:**

<img width="956" alt="image" src="https://user-images.githubusercontent.com/235111/40575932-4443013e-60bc-11e8-9215-a47812ff22d3.png">


<!-- 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" -->
- [X] Has Breaking changes
- [X] Documentation
- [X] Tests
- [X] Ready to be merged <!-- In your opinion, is this ready to be merged as soon as it's reviewed? -->

<!-- feel free to add additional comments -->


codecov[bot]: # [Codecov](https://codecov.io/gh/ViacomInc/data-point/pull/291?src=pr&el=h1) Report
> Merging [#291](https://codecov.io/gh/ViacomInc/data-point/pull/291?src=pr&el=desc) into [master](https://codecov.io/gh/ViacomInc/data-point/commit/38ad606c55ff1005b647f2fdfe4689a6b116276f?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/291/graphs/tree.svg?src=pr&token=LYxItnrx4i&width=650&height=150)](https://codecov.io/gh/ViacomInc/data-point/pull/291?src=pr&el=tree)

```diff
@@          Coverage Diff          @@
##           master   #291   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files         128    128           
  Lines        1818   1810    -8     
  Branches      169    169           
=====================================
- Hits         1818   1810    -8
```


| [Impacted Files](https://codecov.io/gh/ViacomInc/data-point/pull/291?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [...a-point/lib/entity-types/entity-request/resolve.js](https://codecov.io/gh/ViacomInc/data-point/pull/291/diff?src=pr&el=tree#diff-cGFja2FnZXMvZGF0YS1wb2ludC9saWIvZW50aXR5LXR5cGVzL2VudGl0eS1yZXF1ZXN0L3Jlc29sdmUuanM=) | `100% <ø> (ø)` | :arrow_up: |
| [...ata-point/lib/entity-types/entity-model/resolve.js](https://codecov.io/gh/ViacomInc/data-point/pull/291/diff?src=pr&el=tree#diff-cGFja2FnZXMvZGF0YS1wb2ludC9saWIvZW50aXR5LXR5cGVzL2VudGl0eS1tb2RlbC9yZXNvbHZlLmpz) | `100% <100%> (ø)` | :arrow_up: |
| [...data-point/lib/entity-types/base-entity/resolve.js](https://codecov.io/gh/ViacomInc/data-point/pull/291/diff?src=pr&el=tree#diff-cGFja2FnZXMvZGF0YS1wb2ludC9saWIvZW50aXR5LXR5cGVzL2Jhc2UtZW50aXR5L3Jlc29sdmUuanM=) | `100% <100%> (ø)` | :arrow_up: |
| [...oint/lib/entity-types/entity-collection/resolve.js](https://codecov.io/gh/ViacomInc/data-point/pull/291/diff?src=pr&el=tree#diff-cGFja2FnZXMvZGF0YS1wb2ludC9saWIvZW50aXR5LXR5cGVzL2VudGl0eS1jb2xsZWN0aW9uL3Jlc29sdmUuanM=) | `100% <100%> (ø)` | :arrow_up: |
| [...ata-point/lib/entity-types/entity-entry/resolve.js](https://codecov.io/gh/ViacomInc/data-point/pull/291/diff?src=pr&el=tree#diff-cGFja2FnZXMvZGF0YS1wb2ludC9saWIvZW50aXR5LXR5cGVzL2VudGl0eS1lbnRyeS9yZXNvbHZlLmpz) | `100% <100%> (ø)` | :arrow_up: |
| [...data-point/lib/entity-types/entity-hash/resolve.js](https://codecov.io/gh/ViacomInc/data-point/pull/291/diff?src=pr&el=tree#diff-cGFja2FnZXMvZGF0YS1wb2ludC9saWIvZW50aXR5LXR5cGVzL2VudGl0eS1oYXNoL3Jlc29sdmUuanM=) | `100% <100%> (ø)` | :arrow_up: |
| [...point/lib/entity-types/entity-transform/resolve.js](https://codecov.io/gh/ViacomInc/data-point/pull/291/diff?src=pr&el=tree#diff-cGFja2FnZXMvZGF0YS1wb2ludC9saWIvZW50aXR5LXR5cGVzL2VudGl0eS10cmFuc2Zvcm0vcmVzb2x2ZS5qcw==) | `100% <100%> (ø)` | :arrow_up: |
| [...ta-point/lib/entity-types/entity-schema/resolve.js](https://codecov.io/gh/ViacomInc/data-point/pull/291/diff?src=pr&el=tree#diff-cGFja2FnZXMvZGF0YS1wb2ludC9saWIvZW50aXR5LXR5cGVzL2VudGl0eS1zY2hlbWEvcmVzb2x2ZS5qcw==) | `100% <100%> (ø)` | :arrow_up: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/ViacomInc/data-point/pull/291?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/291?src=pr&el=footer). Last update [38ad606...900a826](https://codecov.io/gh/ViacomInc/data-point/pull/291?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).


Patch:
diff --git a/packages/data-point/README.md b/packages/data-point/README.md
index 4ac5be6..616cc87 100644
--- a/packages/data-point/README.md
+++ b/packages/data-point/README.md
@@ -3469,22 +3469,20 @@ function resolve(acc:Accumulator, resolveReducer:function):Promise<Accumulator>
   function resolve (accumulator, resolveReducer) {
     // get Entity Spec
     const spec = accumulator.reducer.spec
-    // resolve 'spec.value' reducer against accumulator
-    return resolveReducer(accumulator, spec.value)
-      .then((acc) => {
-        // execute lodash template against accumulator value
-        const output = spec.template(acc.value)
-        // creates a new acc object with new value
-        return Object.assign({}, acc, {
-          value: output
-        })
-      })
+    // execute lodash template against
+    // accumulator value
+    const value = spec.template(accumulator.value)
+    // set new accumulator.value
+    // this method creates a new acc object
+    return Object.assign({}, accumulator, {
+      value
+    })
   }
 
   /**
   * RenderEntity API
   */
-  const RenderEntity = DataPoint.createEntity('render, create)
+  const RenderEntity = DataPoint.createEntity('render', create)
 
   // Create DataPoint instance
   const dataPoint = DataPoint.create({
diff --git a/packages/data-point/examples/custom-entity-type.js b/packages/data-point/examples/custom-entity-type.js
index 2ba5096..d9d7638 100644
--- a/packages/data-point/examples/custom-entity-type.js
+++ b/packages/data-point/examples/custom-entity-type.js
@@ -29,17 +29,13 @@ function create (id, spec) {
 function resolve (accumulator, resolveReducer) {
   // get Entity Spec
   const spec = accumulator.reducer.spec
-  // resolve 'spec.value' reducer
-  // against accumulator
-  return resolveReducer(accumulator, spec.value).then(acc => {
-    // execute lodash template against
-    // accumulator value
-    const value = spec.template(acc.value)
-    // set new accumulator.value
-    // this method creates a new acc object
-    return Object.assign({}, acc, {
-      value
-    })
+  // execute lodash template against
+  // accumulator value
+  const value = spec.template(accumulator.value)
+  // set new accumulator.value
+  // this method creates a new acc object
+  return Object.assign({}, accumulator, {
+    value
   })
 }
 
diff --git a/packages/data-point/examples/async-example.js b/packages/data-point/examples/registered-entities.js
similarity index 100%
rename from packages/data-point/examples/async-example.js
rename to packages/data-point/examples/registered-entities.js
diff --git a/packages/data-point/lib/entity-types/base-entity/resolve.js b/packages/data-point/lib/entity-types/base-entity/resolve.js
index 0e651e8..b491d05 100644
--- a/packages/data-point/lib/entity-types/base-entity/resolve.js
+++ b/packages/data-point/lib/entity-types/base-entity/resolve.js
@@ -185,6 +185,7 @@ function resolveEntity (manager, resolveReducer, accumulator, reducer, entity) {
 
   const {
     inputType,
+    value,
     before,
     after,
     outputType
@@ -216,6 +217,10 @@ function resolveEntity (manager, resolveReducer, accumulator, reducer, entity) {
     resolveReducer(manager, acc, before)
   )
 
+  result = addToPromiseChain(result, value, acc =>
+    resolveReducer(manager, acc, value)
+  )
+
   result = result.then(acc => {
     acc.debug(acc.uid, '- resolve')
     return entity.resolve(acc, resolveReducer.bind(null, manager))
diff --git a/packages/data-point/lib/entity-types/entity-collection/resolve.js b/packages/data-point/lib/entity-types/entity-collection/resolve.js
index a8d50c3..74edb8c 100644
--- a/packages/data-point/lib/entity-types/entity-collection/resolve.js
+++ b/packages/data-point/lib/entity-types/entity-collection/resolve.js
@@ -5,9 +5,7 @@
  */
 function resolve (accumulator, resolveReducer) {
   const entity = accumulator.reducer.spec
-  return resolveReducer(accumulator, entity.value).then(acc =>
-    resolveReducer(acc, entity.compose)
-  )
+  return resolveReducer(accumulator, entity.compose)
 }
 
 module.exports.resolve = resolve
diff --git a/packages/data-point/lib/entity-types/entity-entry/resolve.js b/packages/data-point/lib/entity-types/entity-entry/resolve.js
index d8c60e2..9c57641 100644
--- a/packages/data-point/lib/entity-types/entity-entry/resolve.js
+++ b/packages/data-point/lib/entity-types/entity-entry/resolve.js
@@ -2,10 +2,7 @@ const _ = require('lodash')
 const utils = require('../../utils')
 
 function resolve (acc, resolveReducer) {
-  const contextTransform = acc.reducer.spec.value
-  let racc = acc
-  racc = utils.set(acc, 'value', _.defaultTo(acc.value, {}))
-  return resolveReducer(racc, contextTransform)
+  return utils.set(acc, 'value', _.defaultTo(acc.value, {}))
 }
 
 module.exports.resolve = resolve
diff --git a/packages/data-point/lib/entity-types/entity-hash/resolve.js b/packages/data-point/lib/entity-types/entity-hash/resolve.js
index a8d50c3..74edb8c 100644
--- a/packages/data-point/lib/entity-types/entity-hash/resolve.js
+++ b/packages/data-point/lib/entity-types/entity-hash/resolve.js
@@ -5,9 +5,7 @@
  */
 function resolve (accumulator, resolveReducer) {
   const entity = accumulator.reducer.spec
-  return resolveReducer(accumulator, entity.value).then(acc =>
-    resolveReducer(acc, entity.compose)
-  )
+  return resolveReducer(accumulator, entity.compose)
 }
 
 module.exports.resolve = resolve
diff --git a/packages/data-point/lib/entity-types/entity-model/resolve.js b/packages/data-point/lib/entity-types/entity-model/resolve.js
index 2ea0206..251858d 100644
--- a/packages/data-point/lib/entity-types/entity-model/resolve.js
+++ b/packages/data-point/lib/entity-types/entity-model/resolve.js
@@ -3,7 +3,7 @@
  * @param {Function} resolveReducer
  */
 function resolve (accumulator, resolveReducer) {
-  return resolveReducer(accumulator, accumulator.reducer.spec.value)
+  return accumulator
 }
 
 module.exports.resolve = resolve
diff --git a/packages/data-point/lib/entity-types/entity-request/resolve.js b/packages/data-point/lib/entity-types/entity-request/resolve.js
index 5714c70..63ee3ad 100644
--- a/packages/data-point/lib/entity-types/entity-request/resolve.js
+++ b/packages/data-point/lib/entity-types/entity-request/resolve.js
@@ -151,9 +151,7 @@ module.exports.resolveRequest = resolveRequest
  * @return {Promise<Accumulator>}
  */
 function resolve (acc, resolveReducer) {
-  const entity = acc.reducer.spec
   return Promise.resolve(acc)
-    .then(itemContext => resolveReducer(itemContext, entity.value))
     .then(itemContext => resolveOptions(itemContext, resolveReducer))
     .then(itemContext => resolveRequest(itemContext, resolveReducer))
 }
diff --git a/packages/data-point/lib/entity-types/entity-schema/resolve.js b/packages/data-point/lib/entity-types/entity-schema/resolve.js
index 9c962b3..96b9cba 100644
--- a/packages/data-point/lib/entity-types/entity-schema/resolve.js
+++ b/packages/data-point/lib/entity-types/entity-schema/resolve.js
@@ -23,11 +23,7 @@ function validateContext (acc) {
 module.exports.validateContext = validateContext
 
 function resolve (acc, resolveReducer) {
-  const value = acc.reducer.spec.value
-
-  return resolveReducer(acc, value).then(racc => {
-    return validateContext(racc)
-  })
+  return validateContext(acc)
 }
 
 module.exports.resolve = resolve
diff --git a/packages/data-point/lib/entity-types/entity-transform/resolve.js b/packages/data-point/lib/entity-types/entity-transform/resolve.js
index deb27d8..b9b4956 100644
--- a/packages/data-point/lib/entity-types/entity-transform/resolve.js
+++ b/packages/data-point/lib/entity-types/entity-transform/resolve.js
@@ -1,6 +1,5 @@
 function resolve (accumulator, resolveReducer) {
-  const entity = accumulator.reducer.spec
-  return resolveReducer(accumulator, entity.value)
+  return accumulator
 }
 
 module.exports.resolve = resolve


Test patch:
diff --git a/packages/data-point/lib/entity-types/entity-collection/resolve.test.js b/packages/data-point/lib/entity-types/entity-collection/resolve.test.js
index 6894edf..7581eb4 100644
--- a/packages/data-point/lib/entity-types/entity-collection/resolve.test.js
+++ b/packages/data-point/lib/entity-types/entity-collection/resolve.test.js
@@ -54,30 +54,15 @@ describe('Collection entity type checking', () => {
   })
 })
 
-describe('entity.collection.value', () => {
-  test('should resolve value Transform', () => {
-    return transform('collection:a.1', testData).then(acc => {
-      expect(acc.value).toEqual([
-        {
-          d1: 2
-        },
-        {
-          d1: 4
-        }
-      ])
-    })
-  })
-})
-
 describe('entity.collection.map', () => {
   test('should resolve map Transform', () => {
-    return transform('collection:b.1', testData).then(acc => {
+    return transform('collection:b.1', testData.a.d).then(acc => {
       expect(acc.value).toEqual([2, 4])
     })
   })
 
   test('should return array with undefined elements if map reducer is empty list', () => {
-    return transform('collection:b.2', testData).then(acc => {
+    return transform('collection:b.2', testData.a.b.c).then(acc => {
       expect(acc.value).toEqual([undefined, undefined, undefined])
     })
   })
@@ -85,7 +70,7 @@ describe('entity.collection.map', () => {
 
 describe('entity.collection.filter', () => {
   test('should resolve filter Transform', () => {
-    return transform('collection:c.1', testData).then(acc => {
+    return transform('collection:c.1', testData.a.d).then(acc => {
       expect(acc.value).toEqual([
         {
           d1: 2
@@ -95,13 +80,13 @@ describe('entity.collection.filter', () => {
   })
 
   test('it should resolve filter transform for collection containing filter property', () => {
-    return transform('collection:c.2', testData).then(acc => {
+    return transform('collection:c.2', testData.a.b.c).then(acc => {
       expect(acc.value).toEqual([1, 3])
     })
   })
 
   test('should return empty array if filter reducer is empty list', () => {
-    return transform('collection:c.3', testData).then(acc => {
+    return transform('collection:c.3', testData.a.b.c).then(acc => {
       expect(acc.value).toEqual([])
     })
   })
@@ -109,19 +94,19 @@ describe('entity.collection.filter', () => {
 
 describe('entity.collection.find', () => {
   test('should resolve find Transform', () => {
-    return transform('collection:d.1', testData).then(acc => {
+    return transform('collection:d.1', testData.a.b.c).then(acc => {
       expect(acc.value).toEqual(1)
     })
   })
 
   test('should resolve to undefined if none found', () => {
-    return transform('collection:d.2', testData).then(acc => {
+    return transform('collection:d.2', testData.a.b.c).then(acc => {
       expect(acc.value).toBeUndefined()
     })
   })
 
   test('should return undefined if find reducer is empty list', () => {
-    return transform('collection:d.3', testData).then(acc => {
+    return transform('collection:d.3', testData.a.b.c).then(acc => {
       expect(acc.value).toEqual(undefined)
     })
   })
@@ -129,13 +114,13 @@ describe('entity.collection.find', () => {
 
 describe('entity.collection.compose', () => {
   test('should resolve one modifier', () => {
-    return transform('collection:j.1', testData).then(acc => {
+    return transform('collection:j.1', testData.a.d).then(acc => {
       expect(acc.value).toEqual([2, 4])
     })
   })
 
   test('should resolve multiple modifiers', () => {
-    return transform('collection:j.2', testData).then(acc => {
+    return transform('collection:j.2', testData.a.d).then(acc => {
       expect(acc.value).toBe(10)
     })
   })
diff --git a/packages/data-point/lib/entity-types/entity-entry/resolve.test.js b/packages/data-point/lib/entity-types/entity-entry/resolve.test.js
index 2bc024d..0e9b260 100644
--- a/packages/data-point/lib/entity-types/entity-entry/resolve.test.js
+++ b/packages/data-point/lib/entity-types/entity-entry/resolve.test.js
@@ -21,7 +21,9 @@ function transform (entityId, value, options) {
       options
     )
   )
-  return resolveEntryEntity(accumulator, resolveReducerBound)
+  return Promise.resolve(true).then(() =>
+    resolveEntryEntity(accumulator, resolveReducerBound)
+  )
 }
 
 beforeAll(() => {
@@ -36,7 +38,7 @@ describe('Entry.resolve', () => {
     })
   })
   test('Entry#resolve - resolve context', () => {
-    return transform('entry:a1', testData).then(result => {
+    return transform('entry:a1', testData.foo).then(result => {
       expect(result.value).toEqual(1)
     })
   })
diff --git a/packages/data-point/lib/entity-types/entity-hash/resolve.test.js b/packages/data-point/lib/entity-types/entity-hash/resolve.test.js
index 30e7337..08960fd 100644
--- a/packages/data-point/lib/entity-types/entity-hash/resolve.test.js
+++ b/packages/data-point/lib/entity-types/entity-hash/resolve.test.js
@@ -50,26 +50,14 @@ describe('Hash entity type checking', () => {
   })
 })
 
-describe('entity.hash.value', () => {
-  test('should resolve contxt Transform', () => {
-    return transform('hash:a.1', testData).then(acc => {
-      expect(acc.value).toEqual({
-        h1: 1,
-        h2: 2,
-        h3: 3
-      })
-    })
-  })
-})
-
 describe('entity.hash.mapKeys', () => {
   test('should map hash to new keys', () => {
-    return transform('hash:b.1', testData).then(acc => {
+    return transform('hash:b.1', testData.a.h).then(acc => {
       expect(acc.value).toEqual({ h: 2 })
     })
   })
   test('returns empty object if mapKeys is empty', () => {
-    return transform('hash:b.2', testData).then(acc => {
+    return transform('hash:b.2', testData.a.g).then(acc => {
       expect(acc.value).toEqual({})
     })
   })
@@ -77,7 +65,7 @@ describe('entity.hash.mapKeys', () => {
 
 describe('entity.hash.addKeys', () => {
   test('should add new keys to hash', () => {
-    return transform('hash:c.1', testData).then(acc => {
+    return transform('hash:c.1', testData.a.h).then(acc => {
       expect(acc.value).toEqual({
         h1: 1,
         h2: 2,
@@ -87,7 +75,7 @@ describe('entity.hash.addKeys', () => {
     })
   })
   test('it should do nothing if addKeys is empty', () => {
-    return transform('hash:c.2', testData).then(acc => {
+    return transform('hash:c.2', testData.a.g).then(acc => {
       expect(acc.value).toEqual({ g1: 1 })
     })
   })
@@ -95,14 +83,14 @@ describe('entity.hash.addKeys', () => {
 
 describe('entity.hash.omitKeys', () => {
   test('should omit keys from hash', () => {
-    return transform('hash:d.1', testData).then(acc => {
+    return transform('hash:d.1', testData.a.h).then(acc => {
       expect(acc.value).toEqual({
         h3: 3
       })
     })
   })
   test('it should do nothing if omitKeys is empty', () => {
-    return transform('hash:d.2', testData).then(acc => {
+    return transform('hash:d.2', testData.a.g).then(acc => {
       expect(acc.value).toEqual({ g1: 1 })
     })
   })
@@ -110,7 +98,7 @@ describe('entity.hash.omitKeys', () => {
 
 describe('entity.hash.pickKeys', () => {
   test('should only pick keys from hash', () => {
-    return transform('hash:e.1', testData).then(acc => {
+    return transform('hash:e.1', testData.a.h).then(acc => {
       expect(acc.value).toEqual({
         h1: 1,
         h2: 2
@@ -118,7 +106,7 @@ describe('entity.hash.pickKeys', () => {
     })
   })
   test('returns empty object if pickKeys is empty', () => {
-    return transform('hash:e.2', testData).then(acc => {
+    return transform('hash:e.2', testData.a.g).then(acc => {
       expect(acc.value).toEqual({})
     })
   })
@@ -126,7 +114,7 @@ describe('entity.hash.pickKeys', () => {
 
 describe('entity.hash.addValues', () => {
   test('should add values to hash', () => {
-    return transform('hash:f.1', testData).then(acc => {
+    return transform('hash:f.1', testData.a.h).then(acc => {
       expect(acc.value).toEqual({
         h0: 0,
         h1: 1,
@@ -136,7 +124,7 @@ describe('entity.hash.addValues', () => {
     })
   })
   test('it should do nothing if addValues is empty', () => {
-    return transform('hash:f.2', testData).then(acc => {
+    return transform('hash:f.2', testData.a.g).then(acc => {
       expect(acc.value).toEqual({ g1: 1 })
     })
   })
@@ -144,7 +132,7 @@ describe('entity.hash.addValues', () => {
 
 describe('entity.hash.compose', () => {
   test('should resolved composed modifiers', () => {
-    return transform('hash:h.1', testData).then(acc => {
+    return transform('hash:h.1', testData.a.e.e1).then(acc => {
       expect(acc.value).toEqual({
         e3: 'eThree'
       })
diff --git a/packages/data-point/lib/entity-types/entity-model/resolve.test.js b/packages/data-point/lib/entity-types/entity-model/resolve.test.js
index e5a1883..89f0849 100644
--- a/packages/data-point/lib/entity-types/entity-model/resolve.test.js
+++ b/packages/data-point/lib/entity-types/entity-model/resolve.test.js
@@ -2,41 +2,8 @@
 
 const Resolve = require('./resolve')
 
-const FixtureStore = require('../../../test/utils/fixture-store')
-
-const helpers = require('../../helpers')
-
-let dataPoint
-let resolveReducerBound
-
-function transform (entityId, value, options) {
-  const reducer = dataPoint.entities.get(entityId)
-  const accumulator = helpers.createAccumulator(
-    value,
-    Object.assign(
-      {
-        context: reducer
-      },
-      options
-    )
-  )
-  return Resolve.resolve(accumulator, resolveReducerBound)
-}
-
-beforeAll(() => {
-  dataPoint = FixtureStore.create()
-  resolveReducerBound = helpers.createReducerResolver(dataPoint)
-})
-
 describe('Model.resolve', () => {
   test('Entry#resolve - resolve empty', () => {
-    return transform('model:a.0').then(result => {
-      expect(result.value).toEqual(undefined)
-    })
-  })
-  test('Entry#resolve - resolve any Reducer', () => {
-    return transform('model:a.1', 5).then(ac => {
-      expect(ac.value).toEqual(10)
-    })
+    return expect(Resolve.resolve(1)).toEqual(1)
   })
 })
diff --git a/packages/data-point/lib/entity-types/entity-request/resolve.test.js b/packages/data-point/lib/entity-types/entity-request/resolve.test.js
index 400c6b9..43a5f88 100644
--- a/packages/data-point/lib/entity-types/entity-request/resolve.test.js
+++ b/packages/data-point/lib/entity-types/entity-request/resolve.test.js
@@ -336,7 +336,9 @@ describe('resolve', () => {
         ok: true
       })
 
-    return transform('request:a1.4', null).then(result => {
+    return transform('request:a1.4', {
+      source: 'source5'
+    }).then(result => {
       expect(result.value).toEqual({
         ok: true
       })
diff --git a/packages/data-point/lib/entity-types/entity-transform/__snapshots__/index.test.js.snap b/packages/data-point/lib/entity-types/entity-transform/__snapshots__/index.test.js.snap
new file mode 100644
index 0000000..4ec6802
--- /dev/null
+++ b/packages/data-point/lib/entity-types/entity-transform/__snapshots__/index.test.js.snap
@@ -0,0 +1,3 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`API should match API 1`] = `[Function]`;
diff --git a/packages/data-point/lib/entity-types/entity-transform/index.test.js b/packages/data-point/lib/entity-types/entity-transform/index.test.js
new file mode 100644
index 0000000..5e4a720
--- /dev/null
+++ b/packages/data-point/lib/entity-types/entity-transform/index.test.js
@@ -0,0 +1,22 @@
+/* eslint-env jest */
+
+describe('API', () => {
+  it('should match API', () => {
+    expect(require('./index')).toMatchSnapshot()
+  })
+})
+
+describe('integration', () => {
+  it('should create and resolve an entity-transform', () => {
+    const dataPoint = require('../../core').create()
+    const fooReducer = require('../entity-transform/factory').create(
+      '$greeting'
+    )
+    const input = {
+      greeting: 'HelloWorld'
+    }
+    return dataPoint.resolve(fooReducer, input).then(value => {
+      expect(value).toEqual('HelloWorld')
+    })
+  })
+})
diff --git a/packages/data-point/lib/entity-types/entity-transform/resolve.test.js b/packages/data-point/lib/entity-types/entity-transform/resolve.test.js
index 8d5dba6..41eed91 100644
--- a/packages/data-point/lib/entity-types/entity-transform/resolve.test.js
+++ b/packages/data-point/lib/entity-types/entity-transform/resolve.test.js
@@ -2,64 +2,8 @@
 
 const resolveTransformEntity = require('./resolve').resolve
 
-const FixtureStore = require('../../../test/utils/fixture-store')
-
-const helpers = require('../../helpers')
-
-let dataPoint
-let resolveReducerBound
-
-function transform (entityId, value, options) {
-  const reducer = dataPoint.entities.get(entityId)
-  const accumulator = helpers.createAccumulator(
-    value,
-    Object.assign(
-      {
-        context: reducer
-      },
-      options
-    )
-  )
-  return resolveTransformEntity(accumulator, resolveReducerBound)
-}
-
-beforeAll(() => {
-  dataPoint = FixtureStore.create()
-  resolveReducerBound = helpers.createReducerResolver(dataPoint)
-})
-
-describe('entity.transform.value', () => {
-  test('should resolve value Transform', () => {
-    return transform('reducer:a0', {
-      message: 'hello world'
-    }).then(acc => {
-      expect(acc.value).toEqual('hello world')
-    })
-  })
-
-  test('should resolve context Transform', () => {
-    return transform('reducer:a1', {
-      message: 'hello world'
-    }).then(acc => {
-      expect(acc.value).toEqual('HELLO WORLD')
-    })
-  })
-})
-
-describe('entity.reducer.value', () => {
-  test('should resolve value Transform', () => {
-    return transform('reducer:a0', {
-      message: 'hello world'
-    }).then(acc => {
-      expect(acc.value).toEqual('hello world')
-    })
-  })
-
-  test('should resolve context Transform', () => {
-    return transform('reducer:a1', {
-      message: 'hello world'
-    }).then(acc => {
-      expect(acc.value).toEqual('HELLO WORLD')
-    })
+describe('resolve', () => {
+  test('should return acc as is', () => {
+    return expect(resolveTransformEntity(1)).toEqual(1)
   })
 })