From 284d06a4d9e0818ee319fdfab1976d484ce7add8 Mon Sep 17 00:00:00 2001 From: Ilia Smirnov Date: Fri, 20 May 2016 22:35:39 +0300 Subject: [PATCH 1/3] Fixed property list generation All properties after first one are ignored because of "const" inside loop --- models/meta.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/models/meta.js b/models/meta.js index 9ed6b29..b14c106 100644 --- a/models/meta.js +++ b/models/meta.js @@ -29,7 +29,7 @@ module.exports = function (Meta, options) { */ function formatProperties (properties) { const result = {} - for (const key in properties) { + for (key in properties) { if (properties.hasOwnProperty(key)) { result[ key ] = _.clone(properties[ key ]) result[ key ].type = properties[ key ].type.name From 5a4dfd2654b20d05a9462c8ed0cb7bec02311165 Mon Sep 17 00:00:00 2001 From: Ilia Smirnov Date: Sat, 4 Jun 2016 14:17:37 +0300 Subject: [PATCH 2/3] added test for model properties --- test/component-test.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/component-test.js b/test/component-test.js index e435d66..c84b24c 100644 --- a/test/component-test.js +++ b/test/component-test.js @@ -35,6 +35,15 @@ describe('Component test', function() { expect(res.validations).to.be.an('array') }) }) + + it('should find all models fields', function () { + return Meta.getModelById('Category') + .then((res) = > { + expect(res.properties).to.be.an('object') + expect(res.properties.name).to.be.an('object') + expect(res.properties.id).to.be.an('array') + }) + }) }) }) From 89ab294cbb15db2f66abf3d3b9341f8633587910 Mon Sep 17 00:00:00 2001 From: Ilia Smirnov Date: Sat, 4 Jun 2016 16:31:16 +0300 Subject: [PATCH 3/3] fixed id type assertion --- test/component-test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/component-test.js b/test/component-test.js index c84b24c..eb219d9 100644 --- a/test/component-test.js +++ b/test/component-test.js @@ -41,7 +41,7 @@ describe('Component test', function() { .then((res) = > { expect(res.properties).to.be.an('object') expect(res.properties.name).to.be.an('object') - expect(res.properties.id).to.be.an('array') + expect(res.properties.id).to.be.an('object') }) })