Repository: ViacomInc/data-point
Pull request #91 (2018-01-01 13:50:01)

Rename entity resolve files
**What**: Rename each entity type's `reducer.js` file to `resolve.js`. 

**Why**: Having a `resolve.js` to go with `factory.js` is the same convention that we're using for reducers. Naming the files `reducer.js` was also a little confusing because those files are not technically "Reducers" (in the sense of `ReducerPath`, `ReducerObject`, etc).

<!-- 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" -->
- [ ] Documentation n/a
- [ ] Tests n/a
- [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 -->


coveralls: 
[![Coverage Status](https://coveralls.io/builds/14857971/badge)](https://coveralls.io/builds/14857971)

Coverage remained the same at 100.0% when pulling **abcdd81810aabe46a05208070e7fe13a75632a75 on raingerber:rename-entity-resolve-files** into **ce851a75793d16daa4a25fe904295218e6b7245c on ViacomInc:master**.


Patch:
diff --git a/packages/data-point/lib/entity-types/entity-collection/index.js b/packages/data-point/lib/entity-types/entity-collection/index.js
index bcd5a4e..c1ae7c8 100644
--- a/packages/data-point/lib/entity-types/entity-collection/index.js
+++ b/packages/data-point/lib/entity-types/entity-collection/index.js
@@ -1,9 +1,9 @@
 /* eslint global-require: 0 */
 
 const factory = require('./factory')
-const reducer = require('./reducer')
+const resolve = require('./resolve').resolve
 
 module.exports = {
   create: factory.create,
-  resolve: reducer.resolve
+  resolve: resolve
 }
diff --git a/packages/data-point/lib/entity-types/entity-control/index.js b/packages/data-point/lib/entity-types/entity-control/index.js
index bcd5a4e..c1ae7c8 100644
--- a/packages/data-point/lib/entity-types/entity-control/index.js
+++ b/packages/data-point/lib/entity-types/entity-control/index.js
@@ -1,9 +1,9 @@
 /* eslint global-require: 0 */
 
 const factory = require('./factory')
-const reducer = require('./reducer')
+const resolve = require('./resolve').resolve
 
 module.exports = {
   create: factory.create,
-  resolve: reducer.resolve
+  resolve: resolve
 }
diff --git a/packages/data-point/lib/entity-types/entity-entry/index.js b/packages/data-point/lib/entity-types/entity-entry/index.js
index bcd5a4e..c1ae7c8 100644
--- a/packages/data-point/lib/entity-types/entity-entry/index.js
+++ b/packages/data-point/lib/entity-types/entity-entry/index.js
@@ -1,9 +1,9 @@
 /* eslint global-require: 0 */
 
 const factory = require('./factory')
-const reducer = require('./reducer')
+const resolve = require('./resolve').resolve
 
 module.exports = {
   create: factory.create,
-  resolve: reducer.resolve
+  resolve: resolve
 }
diff --git a/packages/data-point/lib/entity-types/entity-hash/index.js b/packages/data-point/lib/entity-types/entity-hash/index.js
index bcd5a4e..c1ae7c8 100644
--- a/packages/data-point/lib/entity-types/entity-hash/index.js
+++ b/packages/data-point/lib/entity-types/entity-hash/index.js
@@ -1,9 +1,9 @@
 /* eslint global-require: 0 */
 
 const factory = require('./factory')
-const reducer = require('./reducer')
+const resolve = require('./resolve').resolve
 
 module.exports = {
   create: factory.create,
-  resolve: reducer.resolve
+  resolve: resolve
 }
diff --git a/packages/data-point/lib/entity-types/entity-request/index.js b/packages/data-point/lib/entity-types/entity-request/index.js
index bcd5a4e..c1ae7c8 100644
--- a/packages/data-point/lib/entity-types/entity-request/index.js
+++ b/packages/data-point/lib/entity-types/entity-request/index.js
@@ -1,9 +1,9 @@
 /* eslint global-require: 0 */
 
 const factory = require('./factory')
-const reducer = require('./reducer')
+const resolve = require('./resolve').resolve
 
 module.exports = {
   create: factory.create,
-  resolve: reducer.resolve
+  resolve: resolve
 }
diff --git a/packages/data-point/lib/entity-types/entity-schema/index.js b/packages/data-point/lib/entity-types/entity-schema/index.js
index bcd5a4e..c1ae7c8 100644
--- a/packages/data-point/lib/entity-types/entity-schema/index.js
+++ b/packages/data-point/lib/entity-types/entity-schema/index.js
@@ -1,9 +1,9 @@
 /* eslint global-require: 0 */
 
 const factory = require('./factory')
-const reducer = require('./reducer')
+const resolve = require('./resolve').resolve
 
 module.exports = {
   create: factory.create,
-  resolve: reducer.resolve
+  resolve: resolve
 }
diff --git a/packages/data-point/lib/entity-types/entity-transform/index.js b/packages/data-point/lib/entity-types/entity-transform/index.js
index bcd5a4e..c1ae7c8 100644
--- a/packages/data-point/lib/entity-types/entity-transform/index.js
+++ b/packages/data-point/lib/entity-types/entity-transform/index.js
@@ -1,9 +1,9 @@
 /* eslint global-require: 0 */
 
 const factory = require('./factory')
-const reducer = require('./reducer')
+const resolve = require('./resolve').resolve
 
 module.exports = {
   create: factory.create,
-  resolve: reducer.resolve
+  resolve: resolve
 }


Test patch:
diff --git a/packages/data-point/lib/entity-types/entity-collection/reducer.js b/packages/data-point/lib/entity-types/entity-collection/resolve.js
similarity index 100%
rename from packages/data-point/lib/entity-types/entity-collection/reducer.js
rename to packages/data-point/lib/entity-types/entity-collection/resolve.js
diff --git a/packages/data-point/lib/entity-types/entity-collection/reducer.test.js b/packages/data-point/lib/entity-types/entity-collection/resolve.test.js
similarity index 97%
rename from packages/data-point/lib/entity-types/entity-collection/reducer.test.js
rename to packages/data-point/lib/entity-types/entity-collection/resolve.test.js
index 6a5c693..960f53e 100644
--- a/packages/data-point/lib/entity-types/entity-collection/reducer.test.js
+++ b/packages/data-point/lib/entity-types/entity-collection/resolve.test.js
@@ -1,7 +1,7 @@
 /* eslint-env jest */
 'use strict'
 
-const Reducer = require('./reducer')
+const resolveCollectionEntity = require('./resolve').resolve
 
 const FixtureStore = require('../../../test/utils/fixture-store')
 const testData = require('../../../test/data.json')
@@ -22,7 +22,7 @@ function transform (entityId, value, options) {
       options
     )
   )
-  return Reducer.resolve(accumulator, resolveTransform)
+  return resolveCollectionEntity(accumulator, resolveTransform)
 }
 
 beforeAll(() => {
diff --git a/packages/data-point/lib/entity-types/entity-control/reducer.js b/packages/data-point/lib/entity-types/entity-control/resolve.js
similarity index 100%
rename from packages/data-point/lib/entity-types/entity-control/reducer.js
rename to packages/data-point/lib/entity-types/entity-control/resolve.js
diff --git a/packages/data-point/lib/entity-types/entity-control/reducer.test.js b/packages/data-point/lib/entity-types/entity-control/resolve.test.js
similarity index 92%
rename from packages/data-point/lib/entity-types/entity-control/reducer.test.js
rename to packages/data-point/lib/entity-types/entity-control/resolve.test.js
index 1a56eb5..d0949db 100644
--- a/packages/data-point/lib/entity-types/entity-control/reducer.test.js
+++ b/packages/data-point/lib/entity-types/entity-control/resolve.test.js
@@ -1,7 +1,7 @@
 /* eslint-env jest */
 'use strict'
 
-const Reducer = require('./reducer')
+const resolveControlEntity = require('./resolve').resolve
 
 const FixtureStore = require('../../../test/utils/fixture-store')
 const testData = require('../../../test/data.json')
@@ -22,7 +22,7 @@ function transform (entityId, value, options) {
       options
     )
   )
-  return Reducer.resolve(accumulator, resolveTransform)
+  return resolveControlEntity(accumulator, resolveTransform)
 }
 
 beforeAll(() => {
diff --git a/packages/data-point/lib/entity-types/entity-entry/reducer.js b/packages/data-point/lib/entity-types/entity-entry/resolve.js
similarity index 100%
rename from packages/data-point/lib/entity-types/entity-entry/reducer.js
rename to packages/data-point/lib/entity-types/entity-entry/resolve.js
diff --git a/packages/data-point/lib/entity-types/entity-entry/reducer.test.js b/packages/data-point/lib/entity-types/entity-entry/resolve.test.js
similarity index 89%
rename from packages/data-point/lib/entity-types/entity-entry/reducer.test.js
rename to packages/data-point/lib/entity-types/entity-entry/resolve.test.js
index 8665968..76daba3 100644
--- a/packages/data-point/lib/entity-types/entity-entry/reducer.test.js
+++ b/packages/data-point/lib/entity-types/entity-entry/resolve.test.js
@@ -1,7 +1,7 @@
 /* eslint-env jest */
 'use strict'
 
-const Reducer = require('./reducer')
+const resolveEntryEntity = require('./resolve').resolve
 
 const FixtureStore = require('../../../test/utils/fixture-store')
 const testData = require('../../../test/data.json')
@@ -22,7 +22,7 @@ function transform (entityId, value, options) {
       options
     )
   )
-  return Reducer.resolve(accumulator, resolveTransform)
+  return resolveEntryEntity(accumulator, resolveTransform)
 }
 
 beforeAll(() => {
diff --git a/packages/data-point/lib/entity-types/entity-hash/reducer.js b/packages/data-point/lib/entity-types/entity-hash/resolve.js
similarity index 100%
rename from packages/data-point/lib/entity-types/entity-hash/reducer.js
rename to packages/data-point/lib/entity-types/entity-hash/resolve.js
diff --git a/packages/data-point/lib/entity-types/entity-hash/reducer.test.js b/packages/data-point/lib/entity-types/entity-hash/resolve.test.js
similarity index 96%
rename from packages/data-point/lib/entity-types/entity-hash/reducer.test.js
rename to packages/data-point/lib/entity-types/entity-hash/resolve.test.js
index 2b0a7d7..98f28e3 100644
--- a/packages/data-point/lib/entity-types/entity-hash/reducer.test.js
+++ b/packages/data-point/lib/entity-types/entity-hash/resolve.test.js
@@ -1,7 +1,7 @@
 /* eslint-env jest */
 'use strict'
 
-const Reducer = require('./reducer')
+const resolveHashEntity = require('./resolve').resolve
 
 const FixtureStore = require('../../../test/utils/fixture-store')
 const testData = require('../../../test/data.json')
@@ -22,7 +22,7 @@ function transform (entityId, value, options) {
       options
     )
   )
-  return Reducer.resolve(accumulator, resolveTransform)
+  return resolveHashEntity(accumulator, resolveTransform)
 }
 
 beforeAll(() => {
diff --git a/packages/data-point/lib/entity-types/entity-request/reducer.js b/packages/data-point/lib/entity-types/entity-request/resolve.js
similarity index 100%
rename from packages/data-point/lib/entity-types/entity-request/reducer.js
rename to packages/data-point/lib/entity-types/entity-request/resolve.js
diff --git a/packages/data-point/lib/entity-types/entity-request/reducer.test.js b/packages/data-point/lib/entity-types/entity-request/resolve.test.js
similarity index 91%
rename from packages/data-point/lib/entity-types/entity-request/reducer.test.js
rename to packages/data-point/lib/entity-types/entity-request/resolve.test.js
index 2c546cc..1916b7e 100644
--- a/packages/data-point/lib/entity-types/entity-request/reducer.test.js
+++ b/packages/data-point/lib/entity-types/entity-request/resolve.test.js
@@ -3,7 +3,7 @@
 
 const _ = require('lodash')
 const nock = require('nock')
-const Reducer = require('./reducer')
+const Resolve = require('./resolve')
 
 const AccumulatorFactory = require('../../accumulator/factory')
 const ReducerFactory = require('../../reducer/factory')
@@ -27,7 +27,7 @@ function transform (entityId, value, options) {
     values
   })
   const acc = Object.assign({}, accumulator, options)
-  return Reducer.resolve(acc, resolveTransform)
+  return Resolve.resolve(acc, resolveTransform)
 }
 
 let locals
@@ -68,7 +68,7 @@ describe('resolveUrlInjections', () => {
       'request:a1'
     )
 
-    const result = Reducer.resolveUrlInjections(
+    const result = Resolve.resolveUrlInjections(
       'http://{value.domain}/api',
       currentAccumulator
     )
@@ -79,7 +79,7 @@ describe('resolveUrlInjections', () => {
 
 describe('resolveUrl', () => {
   test('It should set acc.url value', () => {
-    const acc = Reducer.resolveUrl({
+    const acc = Resolve.resolveUrl({
       reducer: {
         spec: {
           url: 'http://foo'
@@ -90,7 +90,7 @@ describe('resolveUrl', () => {
   })
 
   test('It should do injections', () => {
-    const acc = Reducer.resolveUrl({
+    const acc = Resolve.resolveUrl({
       value: 'bar',
       reducer: {
         spec: {
@@ -110,7 +110,7 @@ describe('resolveOptions', () => {
       },
       transformOptionKeys: []
     })
-    return Reducer.resolveOptions(acc, resolveTransform).then(result => {
+    return Resolve.resolveOptions(acc, resolveTransform).then(result => {
       expect(result.options).toEqual({
         port: 80
       })
@@ -138,7 +138,7 @@ describe('resolveOptions', () => {
         }
       }
     }
-    return Reducer.resolveOptions(acc, resolveTransform).then(result => {
+    return Resolve.resolveOptions(acc, resolveTransform).then(result => {
       expect(result.options).toEqual({
         port: 80,
         qs: {
@@ -151,19 +151,19 @@ describe('resolveOptions', () => {
 
 describe('getRequestOptions', () => {
   test('set defaults', () => {
-    expect(Reducer.getRequestOptions({})).toEqual({
+    expect(Resolve.getRequestOptions({})).toEqual({
       method: 'GET',
       json: true
     })
 
     expect(
-      Reducer.getRequestOptions({
+      Resolve.getRequestOptions({
         json: false
       }).json
     ).toBe(false)
 
     expect(
-      Reducer.getRequestOptions({
+      Resolve.getRequestOptions({
         timeout: 100
       })
     ).toEqual({
@@ -189,7 +189,7 @@ describe('resolveRequest', () => {
       }
     }
 
-    return Reducer.resolveRequest(acc).then(result => {
+    return Resolve.resolveRequest(acc).then(result => {
       expect(result.value).toEqual({
         ok: true
       })
@@ -215,19 +215,19 @@ describe('inspect', () => {
     console.info = jest.fn()
     const acc = getAcc()
     acc.params.inspect = undefined
-    Reducer.inspect(acc)
+    Resolve.inspect(acc)
     expect(console.info).not.toBeCalled()
   })
   test('It should not execute utils.inspect', () => {
     console.info = jest.fn()
-    Reducer.inspect(getAcc())
+    Resolve.inspect(getAcc())
     expect(console.info.mock.calls[0]).toContain('test:test')
   })
   test('It should output options', () => {
     console.info = jest.fn()
     const acc = getAcc()
     _.set(acc, 'options', { options: 1 })
-    Reducer.inspect(acc)
+    Resolve.inspect(acc)
     expect(console.info.mock.calls[0]).toContain('\noptions:')
   })
 })
diff --git a/packages/data-point/lib/entity-types/entity-schema/reducer.js b/packages/data-point/lib/entity-types/entity-schema/resolve.js
similarity index 100%
rename from packages/data-point/lib/entity-types/entity-schema/reducer.js
rename to packages/data-point/lib/entity-types/entity-schema/resolve.js
diff --git a/packages/data-point/lib/entity-types/entity-schema/reducer.test.js b/packages/data-point/lib/entity-types/entity-schema/resolve.test.js
similarity index 89%
rename from packages/data-point/lib/entity-types/entity-schema/reducer.test.js
rename to packages/data-point/lib/entity-types/entity-schema/resolve.test.js
index b8e8312..6f750fc 100644
--- a/packages/data-point/lib/entity-types/entity-schema/reducer.test.js
+++ b/packages/data-point/lib/entity-types/entity-schema/resolve.test.js
@@ -1,7 +1,7 @@
 /* eslint-env jest */
 'use strict'
 
-const Reducer = require('./reducer')
+const resolveSchemaEntity = require('./resolve').resolve
 
 const FixtureStore = require('../../../test/utils/fixture-store')
 
@@ -21,7 +21,7 @@ function transform (entityId, value, options) {
       options
     )
   )
-  return Reducer.resolve(accumulator, resolveTransform)
+  return resolveSchemaEntity(accumulator, resolveTransform)
 }
 
 beforeAll(() => {
diff --git a/packages/data-point/lib/entity-types/entity-transform/reducer.js b/packages/data-point/lib/entity-types/entity-transform/resolve.js
similarity index 100%
rename from packages/data-point/lib/entity-types/entity-transform/reducer.js
rename to packages/data-point/lib/entity-types/entity-transform/resolve.js
diff --git a/packages/data-point/lib/entity-types/entity-transform/reducer.test.js b/packages/data-point/lib/entity-types/entity-transform/resolve.test.js
similarity index 88%
rename from packages/data-point/lib/entity-types/entity-transform/reducer.test.js
rename to packages/data-point/lib/entity-types/entity-transform/resolve.test.js
index 752ff1d..a888780 100644
--- a/packages/data-point/lib/entity-types/entity-transform/reducer.test.js
+++ b/packages/data-point/lib/entity-types/entity-transform/resolve.test.js
@@ -1,7 +1,7 @@
 /* eslint-env jest */
 'use strict'
 
-const Reducer = require('./reducer')
+const resolveTransformEntity = require('./resolve').resolve
 
 const FixtureStore = require('../../../test/utils/fixture-store')
 
@@ -21,7 +21,7 @@ function transform (entityId, value, options) {
       options
     )
   )
-  return Reducer.resolve(accumulator, resolveTransform)
+  return resolveTransformEntity(accumulator, resolveTransform)
 }
 
 beforeAll(() => {