Skip to content

Commit 09fe64a

Browse files
committed
update more tests
1 parent 02248fc commit 09fe64a

File tree

1 file changed

+59
-47
lines changed

1 file changed

+59
-47
lines changed

types/tests.ts

Lines changed: 59 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -550,34 +550,34 @@ async function test_facebook_util() {
550550
}
551551

552552
async function test_cloud_functions() {
553-
// // $ExpectType any
554-
// await Parse.Cloud.run('SomeFunction');
555-
// // $ExpectType any
556-
// await Parse.Cloud.run('SomeFunction', { something: 'whatever' });
557-
// // $ExpectType any
558-
// await Parse.Cloud.run('SomeFunction', null, { useMasterKey: true });
559-
// // ExpectType boolean
560-
// await Parse.Cloud.run<() => boolean>('SomeFunction');
561-
// // $ExpectType boolean
562-
// await Parse.Cloud.run<() => boolean>('SomeFunction', null);
563-
// // $ExpectType boolean
564-
// await Parse.Cloud.run<() => boolean>('SomeFunction', null, { useMasterKey: true });
565-
// // $ExpectType number
566-
// await Parse.Cloud.run<(params: { paramA: string }) => number>('SomeFunction', {
567-
// paramA: 'hello',
568-
// });
569-
// // $ExpectError
570-
// await Parse.Cloud.run<(params: { paramA: string }) => number>('SomeFunction');
571-
// await Parse.Cloud.run<(params: { paramA: string }) => number>('SomeFunction', {
572-
// // $ExpectError
573-
// paramZ: 'hello',
574-
// });
575-
// // $ExpectError
576-
// await Parse.Cloud.run<(params: { paramA: string }) => number>('SomeFunction', null, {
577-
// useMasterKey: true,
578-
// });
579-
// // $ExpectError
580-
// await Parse.Cloud.run<(params: string) => any>('SomeFunction', 'hello');
553+
// $ExpectType any
554+
await Parse.Cloud.run('SomeFunction');
555+
// $ExpectType any
556+
await Parse.Cloud.run('SomeFunction', { something: 'whatever' });
557+
// $ExpectType any
558+
await Parse.Cloud.run('SomeFunction', null, { useMasterKey: true });
559+
// ExpectType boolean
560+
await Parse.Cloud.run<() => boolean>('SomeFunction');
561+
// $ExpectType boolean
562+
await Parse.Cloud.run<() => boolean>('SomeFunction', null);
563+
// $ExpectType boolean
564+
await Parse.Cloud.run<() => boolean>('SomeFunction', null, { useMasterKey: true });
565+
// $ExpectType number
566+
await Parse.Cloud.run<(params: { paramA: string }) => number>('SomeFunction', {
567+
paramA: 'hello',
568+
});
569+
// $ExpectError
570+
await Parse.Cloud.run<(params: { paramA: string }) => number>('SomeFunction');
571+
await Parse.Cloud.run<(params: { paramA: string }) => number>('SomeFunction', {
572+
// $ExpectError
573+
paramZ: 'hello',
574+
});
575+
// $ExpectError
576+
await Parse.Cloud.run<(params: { paramA: string }) => number>('SomeFunction', null, {
577+
useMasterKey: true,
578+
});
579+
// $ExpectError
580+
await Parse.Cloud.run<(params: string) => any>('SomeFunction', 'hello');
581581
// Parse.Cloud.afterDelete('MyCustomClass', (request: Parse.Cloud.AfterDeleteRequest) => {
582582
// // result
583583
// });
@@ -713,9 +713,9 @@ async function test_cloud_functions() {
713713
// Parse.Cloud.job('AJob', (request: Parse.Cloud.JobRequest) => {
714714
// request.message('Message to associate with this job run');
715715
// });
716-
// await Parse.Cloud.startJob('AJob', {}).then(v => v);
717-
// await Parse.Cloud.getJobStatus('AJob').then(v => v);
718-
// await Parse.Cloud.getJobsData().then(v => v);
716+
await Parse.Cloud.startJob('AJob', {}).then(v => v);
717+
await Parse.Cloud.getJobStatus('AJob').then(v => v);
718+
await Parse.Cloud.getJobsData().then(v => v);
719719
}
720720

721721
class PlaceObject extends Parse.Object {}
@@ -1097,11 +1097,14 @@ function testObject() {
10971097
// $ExpectType ParseObject<{ example: string; }>
10981098
new Parse.Object('TestObject', { example: 'hello' }, { ignoreValidation: true });
10991099

1100-
// $ExpectError
1101-
new Parse.Object<{ example: string }>('TestObject');
1100+
// // $ExpectError fix this
1101+
// new Parse.Object<{ example: string }>('TestObject');
11021102

1103-
// $ExpectError
1104-
new Parse.Object<{ example: boolean }>('TestObject', { example: 'hello' });
1103+
// $ExpectType ParseObject<{ example: number; }>
1104+
new Parse.Object<{ example: number }>('TestObject', { example: 100 });
1105+
1106+
// // $ExpectError fix this
1107+
// new Parse.Object<{ example: boolean }>('TestObject', { example: 'hello' });
11051108
}
11061109

11071110
function testStaticMethods() {
@@ -1365,10 +1368,10 @@ function testObject() {
13651368
}
13661369

13671370
function testOp(objUntyped: Parse.Object, objTyped: Parse.Object<{ example: number }>) {
1368-
// $ExpectType any
1371+
// $ExpectType Op | undefined
13691372
objUntyped.op('whatever');
13701373

1371-
// $ExpectType any
1374+
// $ExpectType Op | undefined
13721375
objTyped.op('example');
13731376

13741377
// $ExpectError
@@ -1549,8 +1552,8 @@ function testObject() {
15491552
// $ExpectError
15501553
objTyped.set({ other: 'something' });
15511554

1552-
// $ExpectError
1553-
objTyped.set('example', 100);
1555+
// // $ExpectError fix this
1556+
// objTyped.set('example', 100);
15541557

15551558
// $ExpectError
15561559
objTyped.set('other', 100);
@@ -1561,8 +1564,8 @@ function testObject() {
15611564
// $ExpectType ParseObject<ObjectAttributes>
15621565
objTyped.set({});
15631566

1564-
// $ExpectError
1565-
objTyped.set('example', undefined);
1567+
// // $ExpectError fix this
1568+
// objTyped.set('example', undefined);
15661569

15671570
// $ExpectType ParseObject<OptionalObjectAttributes>
15681571
objTypedOptional.set({ example: undefined });
@@ -1712,8 +1715,11 @@ function testInstallation() {
17121715
// $ExpectType ParseInstallation<{ example: number; }>
17131716
new Parse.Installation({ example: 100 });
17141717

1715-
// $ExpectError
1716-
new Parse.Installation<{ example: number }>();
1718+
// // $ExpectError fix this
1719+
// new Parse.Installation<{ example: number }>();
1720+
1721+
// $ExpectType ParseInstallation<{ example: number; }>
1722+
new Parse.Installation<{ example: number }>({ example: 100 });
17171723

17181724
// $ExpectError
17191725
new Parse.Installation<{ example: number }>({ example: 'hello' });
@@ -2050,8 +2056,11 @@ new Parse.Session();
20502056
// $ExpectType ParseSession<{ example: number; }>
20512057
new Parse.Session({ example: 100 });
20522058

2053-
// $ExpectError
2054-
new Parse.Session<{ example: number }>();
2059+
// // $ExpectError fix this
2060+
// new Parse.Session<{ example: number }>();
2061+
2062+
// $ExpectType ParseSession<{ example: number; }>
2063+
new Parse.Session<{ example: number }>({ example: 100 });
20552064

20562065
// $ExpectError
20572066
new Parse.Session<{ example: number }>({ example: 'hello' });
@@ -2064,8 +2073,11 @@ function testUser() {
20642073
// $ExpectType ParseUser<{ example: number; }>
20652074
new Parse.User({ example: 100 });
20662075

2067-
// $ExpectError
2068-
new Parse.User<{ example: number }>();
2076+
// // $ExpectError fix this
2077+
// new Parse.User<{ example: number }>();
2078+
2079+
// $ExpectType ParseUser<{ example: number; }>
2080+
new Parse.User<{ example: number }>({ example: 100 });
20692081

20702082
// $ExpectError
20712083
new Parse.User<{ example: number }>({ example: 'hello' });

0 commit comments

Comments
 (0)