1
1
var should = require ( 'should' ) ;
2
2
var helper = require ( '../support/spec_helper' ) ;
3
3
var ORM = require ( '../../' ) ;
4
+ var common = require ( '../common' ) ;
5
+
6
+ if ( common . protocol ( ) == "mongodb" ) {
7
+ process . exit ( 0 ) ;
8
+ }
4
9
5
10
describe ( "LazyLoad properties" , function ( ) {
6
11
var db = null ;
@@ -42,11 +47,11 @@ describe("LazyLoad properties", function() {
42
47
before ( setup ( ) ) ;
43
48
44
49
it ( "should not be available when fetching an instance" , function ( done ) {
45
- Person . get ( 1 , function ( err , John ) {
50
+ Person . find ( ) . first ( function ( err , John ) {
46
51
should . equal ( err , null ) ;
47
52
48
53
John . should . be . a ( "object" ) ;
49
- John . should . have . property ( "id" , 1 ) ;
54
+
50
55
John . should . have . property ( "name" , "John Doe" ) ;
51
56
John . should . have . property ( "photo" , null ) ;
52
57
@@ -55,7 +60,7 @@ describe("LazyLoad properties", function() {
55
60
} ) ;
56
61
57
62
it ( "should have apropriate accessors" , function ( done ) {
58
- Person . get ( 1 , function ( err , John ) {
63
+ Person . find ( ) . first ( function ( err , John ) {
59
64
should . equal ( err , null ) ;
60
65
61
66
John . should . be . a ( "object" ) ;
@@ -68,7 +73,7 @@ describe("LazyLoad properties", function() {
68
73
} ) ;
69
74
70
75
it ( "getAccessor should return property" , function ( done ) {
71
- Person . get ( 1 , function ( err , John ) {
76
+ Person . find ( ) . first ( function ( err , John ) {
72
77
should . equal ( err , null ) ;
73
78
74
79
John . should . be . a ( "object" ) ;
@@ -83,7 +88,7 @@ describe("LazyLoad properties", function() {
83
88
} ) ;
84
89
85
90
it ( "setAccessor should change property" , function ( done ) {
86
- Person . get ( 1 , function ( err , John ) {
91
+ Person . find ( ) . first ( function ( err , John ) {
87
92
should . equal ( err , null ) ;
88
93
89
94
John . should . be . a ( "object" ) ;
@@ -108,15 +113,15 @@ describe("LazyLoad properties", function() {
108
113
} ) ;
109
114
110
115
it ( "removeAccessor should change property" , function ( done ) {
111
- Person . get ( 1 , function ( err , John ) {
116
+ Person . find ( ) . first ( function ( err , John ) {
112
117
should . equal ( err , null ) ;
113
118
114
119
John . should . be . a ( "object" ) ;
115
120
116
121
John . removePhoto ( function ( err ) {
117
122
should . equal ( err , null ) ;
118
123
119
- Person . get ( 1 , function ( err , John ) {
124
+ Person . get ( John [ Person . id ] , function ( err , John ) {
120
125
should . equal ( err , null ) ;
121
126
122
127
John . should . be . a ( "object" ) ;
0 commit comments