appc-connector-utils
Advanced tools
Comparing version 0.1.2 to 0.2.2
@@ -15,3 +15,10 @@ const pluralize = require('pluralize') | ||
} | ||
const loadModels = connector.config.generateModels | ||
return Object.keys(modelsMetadata).reduce(function (previousModels, modelName) { | ||
if (loadModels && loadModels.indexOf(modelName) === -1) { | ||
return previousModels | ||
} | ||
const metadata = modelsMetadata[modelName] | ||
@@ -61,2 +68,1 @@ | ||
} | ||
{ | ||
"name": "appc-connector-utils", | ||
"version": "0.1.2", | ||
"version": "0.2.2", | ||
"description": "Utilities for Arrow Connectors", | ||
@@ -5,0 +5,0 @@ "main": "./lib/index.js", |
@@ -50,3 +50,14 @@ const Arrow = require('arrow') | ||
test('generate custom number of models', t => { | ||
connector.config.generateModels = ['People', 'Call'] | ||
const models = modelApi.createFromMetadata(connector, modelMetadata2) | ||
t.equal(Object.keys(models).length, 2) | ||
t.ok(models['People']) | ||
t.ok(models['Call']) | ||
connector.config.generateModels = null | ||
t.end() | ||
}) | ||
test('createFromMetadata - check extra fields are set', t => { | ||
connector.config.skipModelNamespace = true | ||
const models = modelApi.createFromMetadata(connector, modelMetadata3) | ||
@@ -63,8 +74,29 @@ t.equal(Object.keys(models).length, 1) | ||
t.ok(createdModel.metadata.primarykey) | ||
t.equal(createdModel.name, 'appc.test/Airlines') | ||
t.equal(createdModel.name, 'Airlines') | ||
t.ok(createdModel.plural) | ||
t.ok(createdModel.singular) | ||
connector.config.skipModelNamespace = false | ||
t.end() | ||
}) | ||
test('model namespace', t => { | ||
connector.config.modelNamespace = 'appc.test1' | ||
const models = modelApi.createFromMetadata(connector, modelMetadata3) | ||
t.equal(Object.keys(models).length, 1) | ||
const createdModel = models['Airlines'] | ||
t.ok(createdModel) | ||
t.ok(createdModel.actions) | ||
t.ok(createdModel.autogen) | ||
t.same(createdModel.connector, connector) | ||
t.ok(createdModel.disabledActions) | ||
t.ok(createdModel.fields.Name) | ||
t.ok(createdModel.generated) | ||
t.ok(createdModel.metadata.primarykey) | ||
t.equal(createdModel.name, 'appc.test1/Airlines') | ||
t.ok(createdModel.plural) | ||
t.ok(createdModel.singular) | ||
connector.config.modelNamespace = '' | ||
t.end() | ||
}) | ||
test('getRootModelName', t => { | ||
@@ -113,2 +145,1 @@ const name1 = 'appc.test/myModel1' | ||
}) | ||
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
53020
1080