'use strict'

const path = require('path')
const chai = require('chai')
const expect = chai.expect

const SIMPLE_APP = path.join(__dirname, 'fixtures', 'simple-app')
const app = require(path.join(SIMPLE_APP, 'server/server.js'))
const Meta = app.models.Meta

describe('Component test', function() {
  describe('Expected usage', function() {

    it('should have a Meta model', function(done) {
      expect(Meta).to.be.a('function')
      done()
    })

    it('should find all defined models', function() {
      return Meta.getModels()
        .then((res) => {
          expect(res).to.be.an('array')
          expect(res.length).to.equal(10)
        })
    })

    it('should find models details', function() {
      return Meta.getModelById('Category')
        .then((res) => {
          expect(res).to.be.an('object')
          expect(res.acls).to.be.an('array')
          expect(res.mixins).to.be.an('object')
          expect(res.properties).to.be.an('object')
          expect(res.relations).to.be.an('object')
          expect(res.validations).to.be.an('array')
        })
    })

  })
})

@@ -953,32 +953,634 @@
 be.an('object')%0A
+          expect(res.properties.id).to.deep.equal(%7B%0A            id: 1,%0A            type: 'Number',%0A            generated: true,%0A          %7D)%0A          expect(res.properties.name).to.deep.equal(%7B%0A            type: 'String',%0A            required: true,%0A          %7D)%0A          expect(res.properties.created).to.deep.equal(%7B%0A            type: 'Date',%0A            description: 'Created date.',%0A            defaultFn: 'now',%0A          %7D)%0A          expect(res.properties.modified).to.deep.equal(%7B%0A            type: 'Date',%0A            description: 'Modified date.',%0A            defaultFn: 'now',%0A          %7D)%0A
           expect

Extend test to check model properties