@@ -44,10 +44,7 @@ describe('miscellaneous', function() {
44
44
expect ( typeof obj . id ) . toBe ( 'string' ) ;
45
45
expect ( typeof obj . createdAt . toGMTString ( ) ) . toBe ( 'string' ) ;
46
46
done ( ) ;
47
- } , error => {
48
- fail ( JSON . stringify ( error ) ) ;
49
- done ( ) ;
50
- } ) ;
47
+ } , done . fail ) ;
51
48
} ) ;
52
49
53
50
it ( 'get a TestObject' , function ( done ) {
@@ -67,13 +64,13 @@ describe('miscellaneous', function() {
67
64
expect ( data . getSessionToken ( ) ) . not . toBeUndefined ( ) ;
68
65
expect ( data . get ( 'password' ) ) . toBeUndefined ( ) ;
69
66
done ( ) ;
70
- } , error => {
71
- fail ( JSON . stringify ( error ) ) ;
72
- done ( ) ;
73
- } ) ;
67
+ } , done . fail ) ;
74
68
} ) ;
75
69
76
- it ( 'fail to create a duplicate username' , done => {
70
+ it ( 'fail to create a duplicate username' , async done => {
71
+ try {
72
+ await Parse . User . logOut ( ) ;
73
+ } catch ( e ) { /* ignore */ }
77
74
let numCreated = 0 ;
78
75
let numFailed = 0 ;
79
76
const p1 = createTestUser ( ) ;
@@ -101,11 +98,19 @@ describe('miscellaneous', function() {
101
98
fail ( 'one of the users should not have been created' ) ;
102
99
done ( ) ;
103
100
} )
104
- . catch ( done ) ;
101
+ . catch ( ( ) => { } )
102
+ . finally ( async ( ) => {
103
+ try {
104
+ await Parse . User . logOut ( ) ;
105
+ } catch ( e ) { /* ignore */ }
106
+ done ( ) ;
107
+ } ) ;
105
108
} ) ;
106
109
107
110
it ( 'ensure that email is uniquely indexed' , async done => {
108
- Parse . User . disableUnsafeCurrentUser ( ) ;
111
+ try {
112
+ await Parse . User . logOut ( ) ;
113
+ } catch ( e ) { /* ignore */ }
109
114
let numFailed = 0 ;
110
115
let numCreated = 0 ;
111
116
const user1 = new Parse . User ( ) ;
@@ -140,13 +145,19 @@ describe('miscellaneous', function() {
140
145
. then ( ( ) => {
141
146
fail ( 'one of the users should not have been created' ) ;
142
147
} )
143
- . finally ( ( ) => {
144
- Parse . User . enableUnsafeCurrentUser ( ) ;
148
+ . catch ( ( ) => { } )
149
+ . finally ( async ( ) => {
150
+ try {
151
+ await Parse . User . logOut ( ) ;
152
+ } catch ( e ) { /* ignore */ }
145
153
done ( ) ;
146
154
} ) ;
147
155
} ) ;
148
156
149
- it ( 'ensure that if people already have duplicate users, they can still sign up new users' , done => {
157
+ it ( 'ensure that if people already have duplicate users, they can still sign up new users' , async done => {
158
+ try {
159
+ await Parse . User . logOut ( ) ;
160
+ } catch ( e ) { /* ignore */ }
150
161
const config = Config . get ( 'test' ) ;
151
162
// Remove existing data to clear out unique index
152
163
TestUtils . destroyAllDataPermanently ( )
0 commit comments