Skip to content

Commit

Permalink
Fix #992
Browse files Browse the repository at this point in the history
Revert #978
  • Loading branch information
dplewis committed Nov 14, 2019
1 parent 3a66086 commit 8327a55
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
31 changes: 16 additions & 15 deletions integration/test/ParseUserTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -630,21 +630,22 @@ describe('Parse User', () => {
expect(user.get('foo')).toBe('bar');
});

it('can get current with subclass', async () => {
Parse.User.enableUnsafeCurrentUser();

const customUser = new CustomUser({ foo: 'bar' });
customUser.setUsername('username');
customUser.setPassword('password');

await customUser.signUp();
Parse.User._clearCache();

const user = CustomUser.current();
expect(user instanceof CustomUser).toBe(true);
expect(user.doSomething()).toBe(5);
expect(user.get('foo')).toBe('bar');
});
// TODO: @dplewis
// it('can get current with subclass', async () => {
// Parse.User.enableUnsafeCurrentUser();

// const customUser = new CustomUser({ foo: 'bar' });
// customUser.setUsername('username');
// customUser.setPassword('password');

// await customUser.signUp();
// Parse.User._clearCache();

// const user = CustomUser.current();
// expect(user instanceof CustomUser).toBe(true);
// expect(user.doSomething()).toBe(5);
// expect(user.get('foo')).toBe('bar');
// });

it('can logIn user with subclass', async () => {
Parse.User.enableUnsafeCurrentUser();
Expand Down
2 changes: 1 addition & 1 deletion src/ParseUser.js
Original file line number Diff line number Diff line change
Expand Up @@ -869,7 +869,7 @@ const DefaultController = {
updateUserOnDisk(user) {
const path = Storage.generatePath(CURRENT_USER_KEY);
const json = user.toJSON();
json.className = user.constructor.name === 'ParseUser' ? '_User' : user.constructor.name;
json.className = '_User';
return Storage.setItemAsync(
path, JSON.stringify(json)
).then(() => {
Expand Down

0 comments on commit 8327a55

Please sign in to comment.