Skip to content

Commit

Permalink
more tests to basic datatypes
Browse files Browse the repository at this point in the history
  • Loading branch information
mwawrusch committed Oct 19, 2011
1 parent d1ec9a5 commit f00407b
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 13 deletions.
7 changes: 6 additions & 1 deletion TODO.md
@@ -1,3 +1,8 @@
## Pre Release

* A lot :)
* Support all primitive datatypes
* infliction
* embedded documents
* resolve a schema correctly
* resolver object/cb

11 changes: 9 additions & 2 deletions spec/basic_datatypes-spec.coffee
Expand Up @@ -39,15 +39,22 @@ vows.describe("basic_datatypes")
assert.isNotNull @xx.entityInfos['BasicDataTypeTest']
"THEN it's jsonName should be set" : (err,newEntity) ->
assert.equal @xx.entityInfos['BasicDataTypeTest'].jsonName ,"BasicDataTypeTest"
"THEN it's propertyInfos count should be 5" : (err,newEntity) ->
assert.equal newEntity.propertyInfos.length ,5
"THEN it's propertyInfos count should be 4" : (err,newEntity) ->
assert.equal newEntity.propertyInfos.length ,4
"THEN it's string property should return String" : (err,newEntity) ->
assert.equal newEntity.property("stringValue").moongooseDataType() ,String
"THEN it should be able to create a schema" : (err,newEntity) ->
assert.instanceOf newEntity.mongooseSchema(),mongoose.Schema
"THEN that schema needs to have a stringValue member" : (err,newEntity) ->
#console.log newEntity.mongooseSchema().path('stringValue')
assert.equal newEntity.mongooseSchema().path('stringValue').path,"stringValue"
"THEN that schema needs to have a integerValue member" : (err,newEntity) ->
assert.equal newEntity.mongooseSchema().path('integerValue').path,"integerValue"
"THEN that schema needs to have a booleanValue member" : (err,newEntity) ->
assert.equal newEntity.mongooseSchema().path('booleanValue').path,"booleanValue"
"THEN that schema needs to have a numberValue member" : (err,newEntity) ->
assert.equal newEntity.mongooseSchema().path('numberValue').path,"numberValue"

"THEN the schema should be found through the main entry point": (err,newEntity) ->
assert.isNotNull @xx.mongooseSchema("BasicDataTypeTest")
.addBatch
Expand Down
15 changes: 5 additions & 10 deletions spec/fixtures/basic_datatypes.json
Expand Up @@ -7,19 +7,14 @@
"description":"A string value",
"type":"string"
},
"imageValue":{
"format":"image",
"type":"string"
"numberValue":{
"type":"number"
},
"dateValue":{
"type":"string",
"format":"date"
"booleanValue":{
"type":"boolean"
},
"intValue":{
"integerValue":{
"type":"integer"
},
"role":{
"type":"string"
}
}
}

0 comments on commit f00407b

Please sign in to comment.