downstairs
Advanced tools
Comparing version 0.2.9 to 0.2.10
@@ -26,6 +26,2 @@ var Collection = {} | ||
// else if (conditions[key] || conditions[key] === '' || conditions[key] === 0) { | ||
// var clause = Model.sql[key].equals(conditions[key]); | ||
// clauses.push(clause); | ||
// } | ||
} | ||
@@ -250,3 +246,8 @@ } | ||
_self.find(data, cb); | ||
if (result && result.rowCount > 0) { | ||
return _self.find({id: result.rows[0].id}, cb); | ||
} | ||
else { | ||
cb(err, result); | ||
} | ||
}); | ||
@@ -253,0 +254,0 @@ } |
{ | ||
"name": "downstairs", | ||
"description": "A light ORM wrapped about brianc's node-sql and node-pg", | ||
"version": "0.2.9", | ||
"version": "0.2.10", | ||
"homepage": "https://github.com/moneytribeaustralia/downstairs.js", | ||
@@ -6,0 +6,0 @@ "author": { |
1106
scratchpad.txt
@@ -24,2 +24,1106 @@ describe('node-sql augmentations', function(done){ | ||
} | ||
); | ||
); | ||
# buildUserProductDataByCategoryCode = (categoryCode, done) -> | ||
# ectypes.Category.create( { code: categoryCode }, (err, category) -> | ||
# testCategory = category | ||
# ectypes.User.create( (err, user) -> | ||
# testUser = user | ||
# ectypes.Region.create( (err, region) -> | ||
# testRegion = region | ||
# ectypes.Location.create( | ||
# region_id: testRegion.id | ||
# (err, location) -> | ||
# testLocation = location | ||
# ectypes.Company.create( (err, company) -> | ||
# testCompany = company | ||
# ectypes.Provider.create( | ||
# company_id: testCompany.id | ||
# category_id: testCategory.id | ||
# (err, provider) -> | ||
# testProvider = provider | ||
# ectypes.UserProduct.create( | ||
# provider_id: testProvider.id | ||
# user_id: testUser.id | ||
# location_id: testLocation.id | ||
# category_id: testCategory.id | ||
# sentiment_key: 'okay' | ||
# (err, userProduct) -> | ||
# testUserProduct = userProduct | ||
# ectypes.Comment.create( | ||
# user_id: testUser.id | ||
# user_product_id: testUserProduct.id | ||
# (err, comment) -> | ||
# testComment = comment | ||
# ectypes.Location.create( | ||
# postcode: '0000' | ||
# region_id: testRegion.id | ||
# (err, location2) -> | ||
# testLocation2 = location2 | ||
# ectypes.UserToken.create( {user_id: testUser.id }, (err, userToken) -> | ||
# testUserToken = userToken | ||
# ectypes.UserProductAttribute.create( | ||
# user_product_id: testUserProduct.id | ||
# category_id: testCategory.id | ||
# (err, userProductAttribute) -> | ||
# testUserProductAttribute = userProductAttribute | ||
# ectypes.Vicinity.create( | ||
# location_id: testLocation.id | ||
# nearby_location_id: testLocation2.id | ||
# (err, vicinity) -> | ||
# done() | ||
# ) | ||
# ) | ||
# ) | ||
# ) | ||
# ) | ||
# ) | ||
# ) | ||
# ) | ||
# ) | ||
# ) | ||
# ) | ||
# ) | ||
# buildUserProductDataByCategoryCodeAndProductType = (categoryCode, productType, done) -> | ||
# ectypes.Category.create( { code: categoryCode }, (err, category) -> | ||
# testCategory = category | ||
# ectypes.User.create( (err, user) -> | ||
# testUser = user | ||
# ectypes.Region.create( (err, region) -> | ||
# testRegion = region | ||
# ectypes.Location.create( | ||
# region_id: testRegion.id | ||
# (err, location) -> | ||
# testLocation = location | ||
# ectypes.Company.create( (err, company) -> | ||
# testCompany = company | ||
# ectypes.Provider.create( | ||
# company_id: testCompany.id | ||
# category_id: testCategory.id | ||
# (err, provider) -> | ||
# testProvider = provider | ||
# ectypes.UserProduct.create( | ||
# provider_id: testProvider.id | ||
# user_id: testUser.id | ||
# location_id: testLocation.id | ||
# category_id: testCategory.id | ||
# product_type_key: productType | ||
# sentiment_key: 'okay' | ||
# (err, userProduct) -> | ||
# testUserProduct = userProduct | ||
# ectypes.Comment.create( | ||
# user_id: testUser.id | ||
# user_product_id: testUserProduct.id | ||
# (err, comment) -> | ||
# testComment = comment | ||
# ectypes.Location.create( | ||
# postcode: '0000' | ||
# region_id: testRegion.id | ||
# (err, location2) -> | ||
# testLocation2 = location2 | ||
# ectypes.UserToken.create( {user_id: testUser.id }, (err, userToken) -> | ||
# testUserToken = userToken | ||
# ectypes.UserProductAttribute.create( | ||
# user_product_id: testUserProduct.id | ||
# category_id: testCategory.id | ||
# attribute_key: 'frequency' | ||
# (err, userProductAttribute) -> | ||
# testUserProductAttribute = userProductAttribute | ||
# ectypes.Vicinity.create( | ||
# location_id: testLocation.id | ||
# nearby_location_id: testLocation2.id | ||
# (err, vicinity) -> | ||
# done() | ||
# ) | ||
# ) | ||
# ) | ||
# ) | ||
# ) | ||
# ) | ||
# ) | ||
# ) | ||
# ) | ||
# ) | ||
# ) | ||
# ) | ||
# # describe('associations', (done) -> | ||
# # beforeEach( (done) -> helper.resetDb(done) ) | ||
# # beforeEach( (done) -> buildUserProductData(done) ) | ||
# # it('has a user', (done) -> | ||
# # testUserProduct.user( (err, user) -> | ||
# # user.id.should.equal(testUser.id) | ||
# # done() | ||
# # ) | ||
# # ) | ||
# # it('has a provider', (done) -> | ||
# # testUserProduct.provider( (err, provider) -> | ||
# # provider.id.should.equal(testProvider.id) | ||
# # done() | ||
# # ) | ||
# # ) | ||
# # it('has a location', (done) -> | ||
# # testUserProduct.location( (err, location) -> | ||
# # location.id.should.equal(testLocation.id) | ||
# # done() | ||
# # ) | ||
# # ) | ||
# # it('has a category', (done) -> | ||
# # testUserProduct.category( (err, category) -> | ||
# # category.id.should.equal(testCategory.id) | ||
# # done() | ||
# # ) | ||
# # ) | ||
# # it('has many comments', (done) -> | ||
# # testUserProduct.comments( (err, comments) -> | ||
# # comments.length.should.be.greaterThan(0) | ||
# # comments[0].user_product_id.should.equal(testUserProduct.id) | ||
# # done() | ||
# # ) | ||
# # ) | ||
# # it('has many user product attributes', (done) -> | ||
# # testUserProduct.attributes( (err, attributes) -> | ||
# # attributes.length.should.be.greaterThan(0) | ||
# # attributes[0].user_product_id.should.equal(testUserProduct.id) | ||
# # done() | ||
# # ) | ||
# # ) | ||
# # ) | ||
# # describe('service helper functions', (done) -> | ||
# # beforeEach( (done) -> helper.resetDb(done) ) | ||
# # beforeEach( (done) -> buildUserProductData(done) ) | ||
# # it('knows how many comments have been made', (done) -> | ||
# # testUserProduct.commentsCount( (err, count) -> | ||
# # count.should.equal(1) | ||
# # done() | ||
# # ) | ||
# # ) | ||
# # it('knows how many sentiments are saved', (done) -> | ||
# # testUserProduct.sentimentsCount('okay', (err, count) -> | ||
# # count.should.equal(1) | ||
# # done() | ||
# # ) | ||
# # ) | ||
# # it('knows how many members it has', (done) -> | ||
# # testUserProduct.membersCount( (err, count) -> | ||
# # count.should.equal(1) | ||
# # done() | ||
# # ) | ||
# # ) | ||
# # it('converts from mood_id to sentiment_key', (done) -> | ||
# # models.UserProduct.getSentimentKey('1').should.equal('okay') | ||
# # models.UserProduct.getSentimentKey('2').should.equal('not_sure') | ||
# # models.UserProduct.getSentimentKey('3').should.equal('unhappy') | ||
# # models.UserProduct.getSentimentKey('0').should.equal('') | ||
# # done() | ||
# # ) | ||
# # it('converts from sentiment_key to mood_id', (done) -> | ||
# # models.UserProduct.getMoodHighlight('okay').should.equal(4) | ||
# # models.UserProduct.getMoodHighlight('not_sure').should.equal(2) | ||
# # models.UserProduct.getMoodHighlight('unhappy').should.equal(1) | ||
# # models.UserProduct.getMoodHighlight('').should.equal(0) | ||
# # done() | ||
# # ) | ||
# # it('converts year of birth to age group key', (done) -> | ||
# # models.UserProduct.getAgeGroupKey(null).should.equal('00') | ||
# # models.UserProduct.getAgeGroupKey(new Date().getFullYear()).should.equal('01') | ||
# # models.UserProduct.getAgeGroupKey(1975).should.equal('03') | ||
# # models.UserProduct.getAgeGroupKey('1975').should.equal('03') | ||
# # models.UserProduct.getAgeGroupKey(new Date().getFullYear()-30).should.equal('02') | ||
# # models.UserProduct.getAgeGroupKey(new Date().getFullYear()-40).should.equal('03') | ||
# # models.UserProduct.getAgeGroupKey(new Date().getFullYear()-50).should.equal('04') | ||
# # models.UserProduct.getAgeGroupKey(new Date().getFullYear()-60).should.equal('04') | ||
# # models.UserProduct.getAgeGroupKey(new Date().getFullYear()-100).should.equal('05') | ||
# # done() | ||
# # ) | ||
# # ) | ||
# # describe('sentiment change function', (done) -> | ||
# # beforeEach( (done) -> helper.resetDb(done) ) | ||
# # beforeEach( (done) -> buildUserProductData(done) ) | ||
# # it('can change a sentiment for a product', (done) -> | ||
# # testUserProduct.sentiment_key.should.equal('okay') | ||
# # testUserProduct.sentimentChange('not_sure', (err, result) -> | ||
# # result.should.be.ok | ||
# # models.UserProduct.find({ id: testUserProduct.id }, (err, userProduct) -> | ||
# # userProduct.sentiment_key.should.equal('not_sure') | ||
# # done() | ||
# # ) | ||
# # ) | ||
# # ) | ||
# # ) | ||
# # describe('delete function', (done) -> | ||
# # beforeEach( (done) -> helper.resetDb(done) ) | ||
# # beforeEach( (done) -> buildUserProductData(done) ) | ||
# # it('can logically delete a product', (done) -> | ||
# # testUserProduct.is_active.should.be.ok | ||
# # testUserProduct.delete( (err, result) -> | ||
# # result.should.be.ok | ||
# # models.UserProduct.find({ id: testUserProduct.id }, (err, userProduct) -> | ||
# # userProduct.is_active.should.not.be.ok | ||
# # done() | ||
# # ) | ||
# # ) | ||
# # ) | ||
# # ) | ||
# # describe('create product with category code function', (done) -> | ||
# # beforeEach( (done) -> helper.resetDb(done) ) | ||
# # beforeEach( (done) -> buildUserProductData(done) ) | ||
# # it('can create a product', (done) -> | ||
# # data = | ||
# # category_id: null | ||
# # product_type_key: testUserProduct.product_type_key | ||
# # provider_id: testProvider.id | ||
# # sentiment_key: 'not_sure' | ||
# # user_id: testUser.id | ||
# # models.UserProduct.createWithCategoryCode(testCategory.code, data, (err, userProduct) -> | ||
# # should.exist(userProduct) | ||
# # should.not.exist(err) | ||
# # userProduct.id.should.be.a('number') | ||
# # done() | ||
# # ) | ||
# # ) | ||
# # ) | ||
# # describe('get product details data for a health product', (done) -> | ||
# # beforeEach( (done) -> helper.resetDb(done) ) | ||
# # beforeEach( (done) -> buildUserProductDataByCategoryCode('health', done) ) | ||
# # it('gets a data object back', (done) -> | ||
# # models.UserProduct.getDetailsData( testUserProduct, (err, data) -> | ||
# # should.exist(data) | ||
# # should.exist(data.field_health_excess_level) | ||
# # should.exist(data.field_health_cover_level) | ||
# # should.exist(data.field_health_cover_for) | ||
# # should.exist(data.field_postcode) | ||
# # data.field_paying.should.be.a('number') | ||
# # done() | ||
# # ) | ||
# # ) | ||
# # ) | ||
# # describe('get product details data for a mortgage product', (done) -> | ||
# # beforeEach( (done) -> helper.resetDb(done) ) | ||
# # beforeEach( (done) -> buildUserProductDataByCategoryCode('mortgage', done) ) | ||
# # it('gets a data object back', (done) -> | ||
# # models.UserProduct.getDetailsData( testUserProduct, (err, data) -> | ||
# # should.exist(data) | ||
# # should.exist(data.field_mortgage_purpose) | ||
# # should.exist(data.field_mortgage_type) | ||
# # should.exist(data.field_mortgage_fixed_for) | ||
# # data.field_mortgage_paying.should.be.a('number') | ||
# # done() | ||
# # ) | ||
# # ) | ||
# # ) | ||
# # describe('get average data for a car product', (done) -> | ||
# # beforeEach( (done) -> helper.resetDb(done) ) | ||
# # beforeEach( (done) -> buildUserProductDataByCategoryCode('car', done) ) | ||
# # it('gets a data object back', (done) -> | ||
# # testUserProduct.getAverageData( (err, data) -> | ||
# # should.exist(data) | ||
# # should.exist(data.title) | ||
# # should.exist(data.range) | ||
# # done() | ||
# # ) | ||
# # ) | ||
# # ) | ||
# # describe('get average data for a health product', (done) -> | ||
# # beforeEach( (done) -> helper.resetDb(done) ) | ||
# # beforeEach( (done) -> buildUserProductDataByCategoryCode('health', done) ) | ||
# # it('gets a data object back', (done) -> | ||
# # testUserProduct.getAverageData( (err, data) -> | ||
# # should.exist(data) | ||
# # should.exist(data.title) | ||
# # should.exist(data.range) | ||
# # done() | ||
# # ) | ||
# # ) | ||
# # ) | ||
# # describe('get average data for a home product', (done) -> | ||
# # beforeEach( (done) -> helper.resetDb(done) ) | ||
# # beforeEach( (done) -> buildUserProductDataByCategoryCode('home', done) ) | ||
# # it('gets a data object back', (done) -> | ||
# # testUserProduct.getAverageData( (err, data) -> | ||
# # should.exist(data) | ||
# # should.exist(data.title) | ||
# # should.exist(data.range) | ||
# # done() | ||
# # ) | ||
# # ) | ||
# # ) | ||
# # describe('get average data for a life product', (done) -> | ||
# # beforeEach( (done) -> helper.resetDb(done) ) | ||
# # beforeEach( (done) -> buildUserProductDataByCategoryCode('life', done) ) | ||
# # it('gets a data object back', (done) -> | ||
# # testUserProduct.getAverageData( (err, data) -> | ||
# # should.exist(data) | ||
# # should.exist(data.title) | ||
# # should.exist(data.range) | ||
# # done() | ||
# # ) | ||
# # ) | ||
# # ) | ||
# # describe('get average data for a mortgage product', (done) -> | ||
# # beforeEach( (done) -> helper.resetDb(done) ) | ||
# # beforeEach( (done) -> buildUserProductDataByCategoryCodeAndProductType('mortgage', 'variable', done) ) | ||
# # it('gets a data object back', (done) -> | ||
# # testUserProduct.getAverageData( (err, data) -> | ||
# # should.exist(data) | ||
# # should.exist(data.title) | ||
# # should.exist(data.range) | ||
# # done() | ||
# # ) | ||
# # ) | ||
# # ) | ||
# # describe('get average data for a super product', (done) -> | ||
# # beforeEach( (done) -> helper.resetDb(done) ) | ||
# # beforeEach( (done) -> buildUserProductDataByCategoryCode('super', done) ) | ||
# # it('gets a data object back', (done) -> | ||
# # testUserProduct.getAverageData( (err, data) -> | ||
# # should.exist(data) | ||
# # should.exist(data.title) | ||
# # should.exist(data.range) | ||
# # done() | ||
# # ) | ||
# # ) | ||
# # ) | ||
# # describe('get table data for a fixed mortgage product', (done) -> | ||
# # beforeEach( (done) -> helper.resetDb(done) ) | ||
# # beforeEach( (done) -> buildUserProductDataByCategoryCodeAndProductType('mortgage', 'fixed', done) ) | ||
# # it('gets a data object back', (done) -> | ||
# # testUserProduct.getTableData( (err, data) -> | ||
# # should.exist(data) | ||
# # should.exist(data.rows) | ||
# # should.exist(data.footer) | ||
# # should.exist(data.purpose) | ||
# # done() | ||
# # ) | ||
# # ) | ||
# # ) | ||
# # describe('get table data for a variable mortgage product', (done) -> | ||
# # beforeEach( (done) -> helper.resetDb(done) ) | ||
# # beforeEach( (done) -> buildUserProductDataByCategoryCodeAndProductType('mortgage', 'variable', done) ) | ||
# # it('does not get a data object back', (done) -> | ||
# # testUserProduct.getTableData( (err, data) -> | ||
# # should.not.exist(data) | ||
# # done() | ||
# # ) | ||
# # ) | ||
# # ) | ||
# # describe('get table data for a super product', (done) -> | ||
# # beforeEach( (done) -> helper.resetDb(done) ) | ||
# # beforeEach( (done) -> buildUserProductDataByCategoryCode('super', done) ) | ||
# # it('does not get a data object back', (done) -> | ||
# # testUserProduct.getTableData( (err, data) -> | ||
# # should.not.exist(data) | ||
# # done() | ||
# # ) | ||
# # ) | ||
# # ) | ||
# describe('get product details for a product with default provider count', (done) -> | ||
# beforeEach( (done) -> helper.resetDb(done) ) | ||
# beforeEach( (done) -> buildUserProductData(done) ) | ||
# it('gets a data object back', (done) -> | ||
# testUserProduct.getDetails(null, (err, data) -> | ||
# should.exist(data) | ||
# should.exist(data.hightlight) | ||
# should.exist(data.okay) | ||
# should.exist(data.notSure) | ||
# should.exist(data.notOk) | ||
# should.exist(data.rate_stat) | ||
# should.exist(data.ranked) | ||
# should.exist(data.ranked_total) | ||
# should.exist(data.ranked_week) | ||
# should.exist(data.ranked_course) | ||
# should.exist(data.members_week) | ||
# should.exist(data.members_course) | ||
# should.exist(data.comments) | ||
# should.exist(data.list) | ||
# should.exist(data.data) | ||
# done() | ||
# ) | ||
# ) | ||
# ) | ||
# describe('get product details for a product with overridden provider count', (done) -> | ||
# beforeEach( (done) -> helper.resetDb(done) ) | ||
# beforeEach( (done) -> buildUserProductData(done) ) | ||
# it('gets a data object back', (done) -> | ||
# testUserProduct.getDetails(5, (err, data) -> | ||
# should.exist(data) | ||
# should.exist(data.hightlight) | ||
# should.exist(data.okay) | ||
# should.exist(data.notSure) | ||
# should.exist(data.notOk) | ||
# should.exist(data.rate_stat) | ||
# should.exist(data.ranked) | ||
# should.exist(data.ranked_total) | ||
# should.exist(data.ranked_week) | ||
# should.exist(data.ranked_course) | ||
# should.exist(data.members_week) | ||
# should.exist(data.members_course) | ||
# should.exist(data.comments) | ||
# should.exist(data.list) | ||
# should.exist(data.data) | ||
# done() | ||
# ) | ||
# ) | ||
# ) | ||
# describe('get product details for a car product', (done) -> | ||
# beforeEach( (done) -> helper.resetDb(done) ) | ||
# beforeEach( (done) -> buildUserProductDataByCategoryCode('car', done) ) | ||
# it('gets a data object back', (done) -> | ||
# testUserProduct.getDetails(5, (err, data) -> | ||
# should.exist(data) | ||
# should.exist(data.hightlight) | ||
# should.exist(data.okay) | ||
# should.exist(data.notSure) | ||
# should.exist(data.notOk) | ||
# should.exist(data.rate_stat) | ||
# should.exist(data.ranked) | ||
# should.exist(data.ranked_total) | ||
# should.exist(data.ranked_week) | ||
# should.exist(data.ranked_course) | ||
# should.exist(data.members_week) | ||
# should.exist(data.members_course) | ||
# should.exist(data.comments) | ||
# should.exist(data.list) | ||
# should.exist(data.data) | ||
# done() | ||
# ) | ||
# ) | ||
# ) | ||
# describe('get product details for a health product', (done) -> | ||
# beforeEach( (done) -> helper.resetDb(done) ) | ||
# beforeEach( (done) -> buildUserProductDataByCategoryCode('health', done) ) | ||
# it('gets a data object back', (done) -> | ||
# testUserProduct.getDetails(5, (err, data) -> | ||
# should.exist(data) | ||
# should.exist(data.hightlight) | ||
# should.exist(data.okay) | ||
# should.exist(data.notSure) | ||
# should.exist(data.notOk) | ||
# should.exist(data.rate_stat) | ||
# should.exist(data.ranked) | ||
# should.exist(data.ranked_total) | ||
# should.exist(data.ranked_week) | ||
# should.exist(data.ranked_course) | ||
# should.exist(data.members_week) | ||
# should.exist(data.members_course) | ||
# should.exist(data.comments) | ||
# should.exist(data.list) | ||
# should.exist(data.data) | ||
# done() | ||
# ) | ||
# ) | ||
# ) | ||
# describe('get product details for a home product', (done) -> | ||
# beforeEach( (done) -> helper.resetDb(done) ) | ||
# beforeEach( (done) -> buildUserProductDataByCategoryCode('home', done) ) | ||
# it('gets a data object back', (done) -> | ||
# testUserProduct.getDetails(5, (err, data) -> | ||
# should.exist(data) | ||
# should.exist(data.hightlight) | ||
# should.exist(data.okay) | ||
# should.exist(data.notSure) | ||
# should.exist(data.notOk) | ||
# should.exist(data.rate_stat) | ||
# should.exist(data.ranked) | ||
# should.exist(data.ranked_total) | ||
# should.exist(data.ranked_week) | ||
# should.exist(data.ranked_course) | ||
# should.exist(data.members_week) | ||
# should.exist(data.members_course) | ||
# should.exist(data.comments) | ||
# should.exist(data.list) | ||
# should.exist(data.data) | ||
# done() | ||
# ) | ||
# ) | ||
# ) | ||
# describe('get product details for a life product', (done) -> | ||
# beforeEach( (done) -> helper.resetDb(done) ) | ||
# beforeEach( (done) -> buildUserProductDataByCategoryCode('life', done) ) | ||
# it('gets a data object back', (done) -> | ||
# testUserProduct.getDetails(5, (err, data) -> | ||
# should.exist(data) | ||
# should.exist(data.hightlight) | ||
# should.exist(data.okay) | ||
# should.exist(data.notSure) | ||
# should.exist(data.notOk) | ||
# should.exist(data.rate_stat) | ||
# should.exist(data.ranked) | ||
# should.exist(data.ranked_total) | ||
# should.exist(data.ranked_week) | ||
# should.exist(data.ranked_course) | ||
# should.exist(data.members_week) | ||
# should.exist(data.members_course) | ||
# should.exist(data.comments) | ||
# should.exist(data.list) | ||
# should.exist(data.data) | ||
# done() | ||
# ) | ||
# ) | ||
# ) | ||
# describe('get product details for a mortgage fixed product', (done) -> | ||
# beforeEach( (done) -> helper.resetDb(done) ) | ||
# beforeEach( (done) -> buildUserProductDataByCategoryCodeAndProductType('mortgage', 'fixed', done) ) | ||
# it('gets a data object back', (done) -> | ||
# testUserProduct.getDetails(5, (err, data) -> | ||
# should.exist(data) | ||
# should.exist(data.hightlight) | ||
# should.exist(data.okay) | ||
# should.exist(data.notSure) | ||
# should.exist(data.notOk) | ||
# should.exist(data.rate_stat) | ||
# should.exist(data.ranked) | ||
# should.exist(data.ranked_total) | ||
# should.exist(data.ranked_week) | ||
# should.exist(data.ranked_course) | ||
# should.exist(data.members_week) | ||
# should.exist(data.members_course) | ||
# should.exist(data.comments) | ||
# should.exist(data.list) | ||
# should.exist(data.data) | ||
# should.exist(data.table) | ||
# done() | ||
# ) | ||
# ) | ||
# ) | ||
# describe('get product details for a mortgage variable product', (done) -> | ||
# beforeEach( (done) -> helper.resetDb(done) ) | ||
# beforeEach( (done) -> buildUserProductDataByCategoryCodeAndProductType('mortgage', 'variable', done) ) | ||
# it('gets a data object back', (done) -> | ||
# testUserProduct.getDetails(5, (err, data) -> | ||
# should.exist(data) | ||
# should.exist(data.hightlight) | ||
# should.exist(data.okay) | ||
# should.exist(data.notSure) | ||
# should.exist(data.notOk) | ||
# should.exist(data.rate_stat) | ||
# should.exist(data.ranked) | ||
# should.exist(data.ranked_total) | ||
# should.exist(data.ranked_week) | ||
# should.exist(data.ranked_course) | ||
# should.exist(data.members_week) | ||
# should.exist(data.members_course) | ||
# should.exist(data.comments) | ||
# should.exist(data.list) | ||
# should.exist(data.data) | ||
# done() | ||
# ) | ||
# ) | ||
# ) | ||
# describe('get product details for a super product', (done) -> | ||
# beforeEach( (done) -> helper.resetDb(done) ) | ||
# beforeEach( (done) -> buildUserProductDataByCategoryCode('super', done) ) | ||
# it('gets a data object back', (done) -> | ||
# testUserProduct.getDetails(5, (err, data) -> | ||
# should.exist(data) | ||
# should.exist(data.hightlight) | ||
# should.exist(data.okay) | ||
# should.exist(data.notSure) | ||
# should.exist(data.notOk) | ||
# should.exist(data.rate_stat) | ||
# should.exist(data.ranked) | ||
# should.exist(data.ranked_total) | ||
# should.exist(data.ranked_week) | ||
# should.exist(data.ranked_course) | ||
# should.exist(data.members_week) | ||
# should.exist(data.members_course) | ||
# should.exist(data.comments) | ||
# should.exist(data.list) | ||
# should.exist(data.data) | ||
# done() | ||
# ) | ||
# ) | ||
# ) | ||
# # describe('get xml attributes for a car product', (done) -> | ||
# # beforeEach( (done) -> helper.resetDb(done) ) | ||
# # beforeEach( (done) -> buildUserProductDataByCategoryCode('car', done) ) | ||
# # it('returns an xml string with the product attributes', (done) -> | ||
# # testUserProduct.getXmlAttributes( (err, xmlString) -> | ||
# # should.exist(xmlString) | ||
# # done() | ||
# # ) | ||
# # ) | ||
# # ) | ||
# # describe('get xml attributes for a health product', (done) -> | ||
# # beforeEach( (done) -> helper.resetDb(done) ) | ||
# # beforeEach( (done) -> buildUserProductDataByCategoryCode('health', done) ) | ||
# # it('returns an xml string with the product attributes', (done) -> | ||
# # testUserProduct.getXmlAttributes( (err, xmlString) -> | ||
# # should.exist(xmlString) | ||
# # done() | ||
# # ) | ||
# # ) | ||
# # ) | ||
# # describe('get xml attributes for a home product', (done) -> | ||
# # beforeEach( (done) -> helper.resetDb(done) ) | ||
# # beforeEach( (done) -> buildUserProductDataByCategoryCode('home', done) ) | ||
# # it('returns an xml string with the product attributes', (done) -> | ||
# # testUserProduct.getXmlAttributes( (err, xmlString) -> | ||
# # should.exist(xmlString) | ||
# # done() | ||
# # ) | ||
# # ) | ||
# # ) | ||
# # describe('get xml attributes for a life product', (done) -> | ||
# # beforeEach( (done) -> helper.resetDb(done) ) | ||
# # beforeEach( (done) -> buildUserProductDataByCategoryCode('life', done) ) | ||
# # it('returns an xml string with the product attributes', (done) -> | ||
# # testUserProduct.getXmlAttributes( (err, xmlString) -> | ||
# # should.exist(xmlString) | ||
# # done() | ||
# # ) | ||
# # ) | ||
# # ) | ||
# # describe('get xml attributes for a mortgage product', (done) -> | ||
# # beforeEach( (done) -> helper.resetDb(done) ) | ||
# # beforeEach( (done) -> buildUserProductDataByCategoryCode('mortgage', done) ) | ||
# # it('returns an xml string with the product attributes', (done) -> | ||
# # testUserProduct.getXmlAttributes( (err, xmlString) -> | ||
# # should.exist(xmlString) | ||
# # done() | ||
# # ) | ||
# # ) | ||
# # ) | ||
# # describe('get xml attributes for a super product', (done) -> | ||
# # beforeEach( (done) -> helper.resetDb(done) ) | ||
# # beforeEach( (done) -> buildUserProductDataByCategoryCode('super', done) ) | ||
# # it('returns an xml string with the product attributes', (done) -> | ||
# # testUserProduct.getXmlAttributes( (err, xmlString) -> | ||
# # should.exist(xmlString) | ||
# # done() | ||
# # ) | ||
# # ) | ||
# # ) | ||
# # describe('Edit save product details for car product', (done) -> | ||
# # beforeEach( (done) -> helper.resetDb(done) ) | ||
# # beforeEach( (done) -> buildUserProductDataByCategoryCode('car', done) ) | ||
# # it('saves the new product details', (done) -> | ||
# # data = | ||
# # field_postcode: "3133" | ||
# # field_frequancy: "yearly" | ||
# # field_car_provider: "20604" | ||
# # field_health_cover_level: "3" | ||
# # field_car_make: "1" | ||
# # field_health_excess_level: "1" | ||
# # field_renewal: "01" | ||
# # field_paying: "600" | ||
# # testUserProduct.editSave(data, (err, userProduct) -> | ||
# # should.exist(userProduct) | ||
# # userProduct.attributes( (err, userProductAttributes) -> | ||
# # should.exist(userProductAttributes) | ||
# # for userProductAttribute in userProductAttributes | ||
# # if userProductAttribute.attribute_key == 'excess_level' | ||
# # JSON.parse(userProductAttribute.value).value_key.should.equal(data.field_health_excess_level) | ||
# # done() | ||
# # ) | ||
# # ) | ||
# # ) | ||
# # ) | ||
# # describe('Edit save product details for health product', (done) -> | ||
# # beforeEach( (done) -> helper.resetDb(done) ) | ||
# # beforeEach( (done) -> buildUserProductDataByCategoryCode('health', done) ) | ||
# # it('saves the new product details', (done) -> | ||
# # data = | ||
# # field_paying : "251" | ||
# # field_frequancy: "monthly" | ||
# # field_postcode: "3133" | ||
# # field_health_cover_level: "3" | ||
# # field_health_cover_for: "03" | ||
# # field_health_excess_level: "2" | ||
# # field_renewal: "02" | ||
# # field_health_provider: "20935" | ||
# # field_health_type: "hostital_extra" | ||
# # testUserProduct.editSave(data, (err, userProduct) -> | ||
# # should.exist(userProduct) | ||
# # userProduct.attributes( (err, userProductAttributes) -> | ||
# # should.exist(userProductAttributes) | ||
# # for userProductAttribute in userProductAttributes | ||
# # if userProductAttribute.attribute_key == 'excess_level' | ||
# # JSON.parse(userProductAttribute.value).value_key.should.equal(data.field_health_excess_level) | ||
# # done() | ||
# # ) | ||
# # ) | ||
# # ) | ||
# # ) | ||
# # describe('Edit save product details for home product', (done) -> | ||
# # beforeEach( (done) -> helper.resetDb(done) ) | ||
# # beforeEach( (done) -> buildUserProductDataByCategoryCode('home', done) ) | ||
# # it('saves the new product details', (done) -> | ||
# # data = | ||
# # field_home_provider: "21535" | ||
# # field_home_cover_type: "03" | ||
# # field_postcode: "3133" | ||
# # field_frequancy: "monthly" | ||
# # field_home_contents_value: "2" | ||
# # field_health_cover_level: "3" | ||
# # field_health_excess_level: "2" | ||
# # field_home_building_type: "01" | ||
# # field_renewal: "00" | ||
# # field_paying: "70" | ||
# # testUserProduct.editSave(data, (err, userProduct) -> | ||
# # should.exist(userProduct) | ||
# # userProduct.attributes( (err, userProductAttributes) -> | ||
# # should.exist(userProductAttributes) | ||
# # for userProductAttribute in userProductAttributes | ||
# # if userProductAttribute.attribute_key == 'excess_level' | ||
# # JSON.parse(userProductAttribute.value).value_key.should.equal(data.field_health_excess_level) | ||
# # done() | ||
# # ) | ||
# # ) | ||
# # ) | ||
# # ) | ||
# # describe('Edit save product details for life product', (done) -> | ||
# # beforeEach( (done) -> helper.resetDb(done) ) | ||
# # beforeEach( (done) -> buildUserProductDataByCategoryCode('life', done) ) | ||
# # it('saves the new product details', (done) -> | ||
# # data = | ||
# # field_postcode: "3133" | ||
# # field_frequancy: "monthly" | ||
# # field_life_cover_amount: "" | ||
# # field_life_provider: "20605" | ||
# # field_year_birth: "1975" | ||
# # field_renewal: "00" | ||
# # field_paying: "50" | ||
# # testUserProduct.editSave(data, (err, userProduct) -> | ||
# # should.exist(userProduct) | ||
# # userProduct.attributes( (err, userProductAttributes) -> | ||
# # should.exist(userProductAttributes) | ||
# # for userProductAttribute in userProductAttributes | ||
# # if userProductAttribute.attribute_key == 'year_of_birth' | ||
# # JSON.parse(userProductAttribute.value).number.should.equal(data.field_year_birth) | ||
# # done() | ||
# # ) | ||
# # ) | ||
# # ) | ||
# # ) | ||
# # describe('Edit save product details for mortgage product', (done) -> | ||
# # beforeEach( (done) -> helper.resetDb(done) ) | ||
# # beforeEach( (done) -> buildUserProductDataByCategoryCode('mortgage', done) ) | ||
# # it('saves the new product details', (done) -> | ||
# # data = | ||
# # field_postcode: "3133" | ||
# # field_mortgage_hm_rate: "" | ||
# # field_mortgage_provider: "21538" | ||
# # field_mortgage_paying: "" | ||
# # field_mortgage_type: "variable" | ||
# # field_mortgage_purpose: "02" | ||
# # field_mortage_loan_amount: "" | ||
# # testUserProduct.editSave(data, (err, userProduct) -> | ||
# # should.exist(userProduct) | ||
# # userProduct.attributes( (err, userProductAttributes) -> | ||
# # should.exist(userProductAttributes) | ||
# # for userProductAttribute in userProductAttributes | ||
# # if userProductAttribute.attribute_key == 'loan_purpose' | ||
# # JSON.parse(userProductAttribute.value).value_key.should.equal(data.field_mortgage_purpose) | ||
# # done() | ||
# # ) | ||
# # ) | ||
# # ) | ||
# # ) | ||
# # describe('Edit save product details for super product', (done) -> | ||
# # beforeEach( (done) -> helper.resetDb(done) ) | ||
# # beforeEach( (done) -> buildUserProductDataByCategoryCode('super', done) ) | ||
# # it('saves the new product details', (done) -> | ||
# # data = | ||
# # field_postcode: "3133" | ||
# # field_super_tpd: "not_sure" | ||
# # field_super_life: "no" | ||
# # field_super_provider: "20611" | ||
# # field_year_birth: "1975" | ||
# # field_super_balance: "0" | ||
# # field_super_fund_inv: "2" | ||
# # testUserProduct.editSave(data, (err, userProduct) -> | ||
# # should.exist(userProduct) | ||
# # userProduct.attributes( (err, userProductAttributes) -> | ||
# # should.exist(userProductAttributes) | ||
# # for userProductAttribute in userProductAttributes | ||
# # if userProductAttribute.attribute_key == 'year_of_birth' | ||
# # JSON.parse(userProductAttribute.value).number.should.equal(data.field_year_birth) | ||
# # done() | ||
# # ) | ||
# # ) | ||
# # ) | ||
# # ) | ||
# # describe('Classification for car product', (done) -> | ||
# # beforeEach( (done) -> helper.resetDb(done) ) | ||
# # beforeEach( (done) -> buildUserProductDataByCategoryCode('car', done) ) | ||
# # it('saves classification for user product', (done) -> | ||
# # testUserProduct.saveClassification( (err, userProduct) -> | ||
# # should.exist(userProduct) | ||
# # models.UserProductClassification.findAll( { user_product_id: userProduct.id}, (err, userProductClassifications) -> | ||
# # should.exist(userProductClassifications) | ||
# # userProductClassifications.length.should.be.greaterThan(0) | ||
# # done() | ||
# # ) | ||
# # ) | ||
# # ) | ||
# # ) | ||
# # describe('Classification for health product', (done) -> | ||
# # beforeEach( (done) -> helper.resetDb(done) ) | ||
# # beforeEach( (done) -> buildUserProductDataByCategoryCode('health', done) ) | ||
# # it('saves classification for user product', (done) -> | ||
# # testUserProduct.saveClassification( (err, userProduct) -> | ||
# # should.exist(userProduct) | ||
# # models.UserProductClassification.findAll( { user_product_id: userProduct.id}, (err, userProductClassifications) -> | ||
# # should.exist(userProductClassifications) | ||
# # userProductClassifications.length.should.be.greaterThan(0) | ||
# # done() | ||
# # ) | ||
# # ) | ||
# # ) | ||
# # ) | ||
# # describe('classification for home product', (done) -> | ||
# # beforeEach( (done) -> helper.resetDb(done) ) | ||
# # beforeEach( (done) -> buildUserProductDataByCategoryCode('home', done) ) | ||
# # it('saves classification for user product', (done) -> | ||
# # testUserProduct.saveClassification( (err, userProduct) -> | ||
# # should.exist(userProduct) | ||
# # models.UserProductClassification.findAll( { user_product_id: userProduct.id}, (err, userProductClassifications) -> | ||
# # should.exist(userProductClassifications) | ||
# # userProductClassifications.length.should.be.greaterThan(0) | ||
# # done() | ||
# # ) | ||
# # ) | ||
# # ) | ||
# # ) | ||
# # describe('Classification for life product', (done) -> | ||
# # beforeEach( (done) -> helper.resetDb(done) ) | ||
# # beforeEach( (done) -> buildUserProductDataByCategoryCode('life', done) ) | ||
# # it('saves classification for user product', (done) -> | ||
# # testUserProduct.saveClassification( (err, userProduct) -> | ||
# # should.exist(userProduct) | ||
# # models.UserProductClassification.findAll( { user_product_id: userProduct.id}, (err, userProductClassifications) -> | ||
# # should.exist(userProductClassifications) | ||
# # userProductClassifications.length.should.be.greaterThan(0) | ||
# # done() | ||
# # ) | ||
# # ) | ||
# # ) | ||
# # ) | ||
# # describe('Classification for mortgage product', (done) -> | ||
# # beforeEach( (done) -> helper.resetDb(done) ) | ||
# # beforeEach( (done) -> buildUserProductDataByCategoryCode('mortgage', done) ) | ||
# # it('saves classification for user product', (done) -> | ||
# # testUserProduct.saveClassification( (err, userProduct) -> | ||
# # should.exist(userProduct) | ||
# # models.UserProductClassification.findAll( { user_product_id: userProduct.id}, (err, userProductClassifications) -> | ||
# # should.exist(userProductClassifications) | ||
# # userProductClassifications.length.should.be.greaterThan(0) | ||
# # done() | ||
# # ) | ||
# # ) | ||
# # ) | ||
# # ) | ||
# # describe('Classification for super product', (done) -> | ||
# # beforeEach( (done) -> helper.resetDb(done) ) | ||
# # beforeEach( (done) -> buildUserProductDataByCategoryCode('super', done) ) | ||
# # it('saves classification for user product', (done) -> | ||
# # testUserProduct.saveClassification( (err, userProduct) -> | ||
# # should.exist(userProduct) | ||
# # models.UserProductClassification.findAll( { user_product_id: userProduct.id}, (err, userProductClassifications) -> | ||
# # should.exist(userProductClassifications) | ||
# # userProductClassifications.length.should.be.greaterThan(0) | ||
# # done() | ||
# # ) | ||
# # ) | ||
# # ) | ||
# # ) | ||
# # we are not supporting location based similarity (or stats) for like for like | ||
# # describe('Similar products for super product', (done) -> | ||
# # beforeEach( (done) -> helper.resetDb(done) ) | ||
# # beforeEach( (done) -> buildUserProductDataByCategoryCode('super', done) ) | ||
# # it('finds a similar product based on criteria', (done) -> | ||
# # data = | ||
# # category_id: testCategory.id | ||
# # provider_id: testProvider.id | ||
# # location_id: testLocation.id | ||
# # attribute_1_key: testUserProduct.product_type_key | ||
# # attribute_2_key: null | ||
# # models.UserProduct.classify(data, (err, results) -> | ||
# # should.exist(results) | ||
# # results.should.include(testUserProduct.id) | ||
# # done() | ||
# # ) | ||
# # ) | ||
# # ) | ||
# # describe('Ranking data for super product', (done) -> | ||
# # beforeEach( (done) -> helper.resetDb(done) ) | ||
# # beforeEach( (done) -> buildUserProductDataByCategoryCode('super', done) ) | ||
# # it('brings back ranking data for the product', (done) -> | ||
# # ectypes.UserProductAttribute.create( | ||
# # user_product_id: testUserProduct.id | ||
# # category_id: testCategory.id | ||
# # attribute_key: 'you_are_paying' | ||
# # value: { "number": 100 } | ||
# # (err, userProductAttribute) -> | ||
# # testUserProduct.rankingData( (err, results) -> | ||
# # should.exist(results) | ||
# # results.sentiment_key.should.equal(testUserProduct.sentiment_key) | ||
# # results.annual_paying.should.equal(100 * 12) | ||
# # done() | ||
# # ) | ||
# # ) | ||
# # ) | ||
# # ) | ||
# # bug with ectypes where it ignores the second model overrides. | ||
# # bug with ectypes which does not allow objects as defaults. |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
101428
1464
0