|
1 | 1 | import Parse from './Parse';
|
2 | 2 | // Parse is a global type, but it can also be imported
|
3 | 3 |
|
4 |
| -// class GameScore extends Parse.Object { |
5 |
| -// constructor(options?: any) { |
6 |
| -// super('GameScore', options); |
7 |
| -// } |
8 |
| -// } |
| 4 | +class GameScore extends Parse.Object { |
| 5 | + constructor(options?: any) { |
| 6 | + super('GameScore', options); |
| 7 | + } |
| 8 | +} |
9 | 9 |
|
10 |
| -// class Game extends Parse.Object { |
11 |
| -// constructor(options?: any) { |
12 |
| -// super('Game', options); |
13 |
| -// } |
14 |
| -// } |
| 10 | +class Game extends Parse.Object { |
| 11 | + constructor(options?: any) { |
| 12 | + super('Game', options); |
| 13 | + } |
| 14 | +} |
15 | 15 |
|
16 |
| -// function test_config() { |
17 |
| -// Parse.Config.save({ foo: 'bar' }, { foo: true }); |
18 |
| -// Parse.Config.get({ useMasterKey: true }); |
19 |
| -// } |
| 16 | +function test_config() { |
| 17 | + Parse.Config.save({ foo: 'bar' }, { foo: true }); |
| 18 | + Parse.Config.get({ useMasterKey: true }); |
| 19 | +} |
20 | 20 |
|
21 |
| -// function test_object() { |
22 |
| -// const game = new Game(); |
23 |
| -// game.save(null, { |
24 |
| -// useMasterKey: true, |
25 |
| -// sessionToken: 'sometoken', |
26 |
| -// cascadeSave: false, |
27 |
| -// }).then(result => result); |
| 21 | +function test_object() { |
| 22 | + const game = new Game(); |
| 23 | + game.save(null, { |
| 24 | + useMasterKey: true, |
| 25 | + sessionToken: 'sometoken', |
| 26 | + cascadeSave: false, |
| 27 | + }).then(result => result); |
28 | 28 |
|
29 |
| -// if (!game.isNew()) { |
| 29 | + if (!game.isNew()) { |
30 | 30 |
|
31 |
| -// } |
| 31 | + } |
32 | 32 |
|
33 |
| -// if (game.toPointer().className !== 'Game') { |
| 33 | + if (game.toPointer().className !== 'Game') { |
34 | 34 |
|
35 |
| -// } |
| 35 | + } |
36 | 36 |
|
37 |
| -// game.fetch({}); |
| 37 | + game.fetch({}); |
38 | 38 |
|
39 |
| -// // Create a new instance of that class. |
40 |
| -// const gameScore = new GameScore(); |
| 39 | + // Create a new instance of that class. |
| 40 | + const gameScore = new GameScore(); |
41 | 41 |
|
42 |
| -// gameScore.set('score', 1337); |
43 |
| -// gameScore.set('playerName', 'Sean Plott'); |
44 |
| -// gameScore.set('cheatMode', false); |
| 42 | + gameScore.set('score', 1337); |
| 43 | + gameScore.set('playerName', 'Sean Plott'); |
| 44 | + gameScore.set('cheatMode', false); |
45 | 45 |
|
46 |
| -// // Setting attrs using object |
47 |
| -// gameScore.set({ |
48 |
| -// level: '10', |
49 |
| -// difficult: 15, |
50 |
| -// }); |
| 46 | + // Setting attrs using object |
| 47 | + gameScore.set({ |
| 48 | + level: '10', |
| 49 | + difficult: 15, |
| 50 | + }); |
51 | 51 |
|
52 |
| -// const score = gameScore.get('score'); |
53 |
| -// const playerName = gameScore.get('playerName'); |
54 |
| -// const cheatMode = gameScore.get('cheatMode'); |
| 52 | + const score = gameScore.get('score'); |
| 53 | + const playerName = gameScore.get('playerName'); |
| 54 | + const cheatMode = gameScore.get('cheatMode'); |
55 | 55 |
|
56 |
| -// gameScore.increment('score'); |
57 |
| -// gameScore.addUnique('skills', 'flying'); |
58 |
| -// gameScore.addUnique('skills', 'kungfu'); |
59 |
| -// gameScore.addAll('skills', ['kungfu']); |
60 |
| -// gameScore.addAllUnique('skills', ['kungfu']); |
61 |
| -// gameScore.remove('skills', 'flying'); |
62 |
| -// gameScore.removeAll('skills', ['kungFu']); |
63 |
| -// game.set('gameScore', gameScore); |
| 56 | + gameScore.increment('score'); |
| 57 | + gameScore.addUnique('skills', 'flying'); |
| 58 | + gameScore.addUnique('skills', 'kungfu'); |
| 59 | + gameScore.addAll('skills', ['kungfu']); |
| 60 | + gameScore.addAllUnique('skills', ['kungfu']); |
| 61 | + gameScore.remove('skills', 'flying'); |
| 62 | + gameScore.removeAll('skills', ['kungFu']); |
| 63 | + game.set('gameScore', gameScore); |
64 | 64 |
|
65 |
| -// const gameCopy = Game.fromJSON(JSON.parse(JSON.stringify(game)), true); |
| 65 | + const gameCopy = Game.fromJSON(JSON.parse(JSON.stringify(game)), true); |
66 | 66 |
|
67 |
| -// const object = new Parse.Object('TestObject'); |
68 |
| -// object.equals(gameScore); |
69 |
| -// object.fetchWithInclude(['key1', 'key2']); |
70 |
| -// } |
| 67 | + const object = new Parse.Object('TestObject'); |
| 68 | + object.equals(gameScore); |
| 69 | + object.fetchWithInclude(['key1', 'key2']); |
| 70 | +} |
71 | 71 |
|
72 |
| -// function test_errors() { |
73 |
| -// try { |
74 |
| -// throw new Parse.Error(Parse.Error.INTERNAL_SERVER_ERROR, 'sdfds'); |
75 |
| -// } catch (error) { |
76 |
| -// if (error.code !== 1) { |
| 72 | +function test_errors() { |
| 73 | + try { |
| 74 | + throw new Parse.Error(Parse.Error.INTERNAL_SERVER_ERROR, 'sdfds'); |
| 75 | + } catch (error) { |
| 76 | + if (error.code !== 1) { |
77 | 77 |
|
78 |
| -// } |
79 |
| -// } |
80 |
| -// } |
| 78 | + } |
| 79 | + } |
| 80 | +} |
81 | 81 |
|
82 | 82 | // function test_query() {
|
83 | 83 | // const gameScore = new GameScore();
|
@@ -2053,21 +2053,21 @@ import Parse from './Parse';
|
2053 | 2053 | // }
|
2054 | 2054 | // }
|
2055 | 2055 |
|
2056 |
| -function testSession() { |
2057 |
| - function testConstructor() { |
2058 |
| - // $ExpectType ParseSession |
2059 |
| - new Parse.Session(); |
| 2056 | +// function testSession() { |
| 2057 | +// function testConstructor() { |
| 2058 | +// // $ExpectType ParseSession |
| 2059 | +// new Parse.Session(); |
2060 | 2060 |
|
2061 |
| - // $ExpectType ParseSession |
2062 |
| - new Parse.Session({ example: 100 }); |
| 2061 | +// // $ExpectType ParseSession |
| 2062 | +// new Parse.Session({ example: 100 }); |
2063 | 2063 |
|
2064 |
| - // @ts-expect-error |
2065 |
| - new Parse.Session<{ example: number }>(); |
| 2064 | +// // @ts-expect-error |
| 2065 | +// new Parse.Session<{ example: number }>(); |
2066 | 2066 |
|
2067 |
| - // @ts-expect-error |
2068 |
| - new Parse.Session<{ example: number }>({ example: 'hello' }); |
2069 |
| - } |
2070 |
| -} |
| 2067 | +// // @ts-expect-error |
| 2068 | +// new Parse.Session<{ example: number }>({ example: 'hello' }); |
| 2069 | +// } |
| 2070 | +// } |
2071 | 2071 |
|
2072 | 2072 | // function testUser() {
|
2073 | 2073 | // function testConstructor() {
|
|
0 commit comments