-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathcomponent-test.js
More file actions
49 lines (41 loc) · 1.37 KB
/
component-test.js
File metadata and controls
49 lines (41 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
'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')
})
})
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('object')
})
})
})
})