Skip to content

Commit

Permalink
Merge pull request #790 from drew-gross/expiresAt-fix
Browse files Browse the repository at this point in the history
Expires at fix
  • Loading branch information
nlutsenko committed Mar 3, 2016
2 parents 9bc1a35 + befcd45 commit c6406b9
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
19 changes: 18 additions & 1 deletion spec/ParseUser.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ describe('Parse.User testing', () => {
success: function(user) {
Parse.User.logIn("non_existent_user", "asdf3",
expectError(Parse.Error.OBJECT_NOT_FOUND, done));
},
},
error: function(err) {
console.error(err);
fail("Shit should not fail");
Expand Down Expand Up @@ -1763,5 +1763,22 @@ describe('Parse.User testing', () => {
});
});

it("session expiresAt correct format", (done) => {
Parse.User.signUp("asdf", "zxcv", null, {
success: function(user) {
request.get({
url: 'http://localhost:8378/1/classes/_Session',
json: true,
headers: {
'X-Parse-Application-Id': 'test',
'X-Parse-Master-Key': 'test',
},
}, (error, response, body) => {
expect(body.results[0].expiresAt.__type).toEqual('Date');
done();
})
}
});
});
});

2 changes: 1 addition & 1 deletion src/transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -644,7 +644,7 @@ function untransformObject(schema, className, mongoObject, isNestedObject = fals
break;
case 'expiresAt':
case '_expiresAt':
restObject['expiresAt'] = Parse._encode(new Date(mongoObject[key])).iso;
restObject['expiresAt'] = Parse._encode(new Date(mongoObject[key]));
break;
default:
// Check other auth data keys
Expand Down

0 comments on commit c6406b9

Please sign in to comment.