File tree Expand file tree Collapse file tree 2 files changed +10
-25
lines changed
Expand file tree Collapse file tree 2 files changed +10
-25
lines changed Original file line number Diff line number Diff line change @@ -277,7 +277,11 @@ module.exports = function(AV) {
277277 return this . id ;
278278 default :
279279 // 兼容 createdAt、updatedAt
280- return this . attributes [ attr ] || this [ attr ] ;
280+ if ( this . attributes [ attr ] === undefined ) {
281+ return this [ attr ] ;
282+ } else {
283+ return this . attributes [ attr ] ;
284+ }
281285 }
282286 } ,
283287
Original file line number Diff line number Diff line change @@ -13,6 +13,11 @@ describe('files', function() {
1313 expect ( file . ownerId ( ) ) . to . be . ok ( ) ;
1414 expect ( file . id ) . to . be . ok ( ) ;
1515 expect ( file . metaData ( 'format' ) ) . to . be ( 'txt file' ) ;
16+
17+ expect ( file . url ( ) ) . to . be ( file . get ( 'url' ) ) ;
18+ expect ( file . name ( ) ) . to . be ( file . get ( 'name' ) ) ;
19+ expect ( file . metaData ( ) ) . to . be ( file . get ( 'metaData' ) ) ;
20+
1621 file . destroy ( ) . then ( function ( ) {
1722 done ( ) ;
1823 } , function ( error ) {
@@ -22,30 +27,6 @@ describe('files', function() {
2227 done ( error ) ;
2328 } ) ;
2429 } ) ;
25-
26- it ( 'url should equal' , function ( done ) {
27- if ( file . url ( ) === file . get ( 'url' ) ) {
28- done ( ) ;
29- } else {
30- done ( 'failed.' ) ;
31- }
32- } ) ;
33-
34- it ( 'name should equal' , function ( done ) {
35- if ( file . name ( ) === file . get ( 'name' ) ) {
36- done ( ) ;
37- } else {
38- done ( 'failed.' ) ;
39- }
40- } ) ;
41-
42- it ( 'metaData should equal' , function ( done ) {
43- if ( file . metaData ( ) === file . get ( 'metaData' ) ) {
44- done ( ) ;
45- } else {
46- done ( 'failed.' ) ;
47- }
48- } ) ;
4930 } ) ;
5031
5132 describe ( 'Saving base64 image' , function ( ) {
You can’t perform that action at this time.
0 commit comments