Skip to content

Commit 4314a19

Browse files
committed
fix(leaderboard): add missing Leaderboard#destroy
1 parent 23f203e commit 4314a19

File tree

3 files changed

+16
-9
lines changed

3 files changed

+16
-9
lines changed

src/leaderboard.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,5 +321,17 @@ _.extend(
321321
authOptions,
322322
}).then(data => this._finishFetch(data));
323323
},
324+
/**
325+
* (masterKey required) Delete the Leaderboard and its all archived versions.
326+
* @param {AuthOptions} [authOptions]
327+
* @return {void}
328+
*/
329+
destroy(authOptions) {
330+
return AV.request({
331+
method: 'DELETE',
332+
path: `/leaderboard/leaderboards/${this.statisticName}`,
333+
authOptions,
334+
}).then(() => undefined);
335+
},
324336
}
325337
);

storage.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -847,6 +847,7 @@ export class Leaderboard {
847847
authOptions?: AuthOptions
848848
): Promise<Leaderboard>;
849849
reset(authOptions?: AuthOptions): Promise<Leaderboard>;
850+
destroy(authOptions?: AuthOptions): Promise<void>;
850851
}
851852

852853
export enum LeaderboardOrder {

test/leaderboard.js

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -150,13 +150,7 @@ describe('Leaderboard', () => {
150150
});
151151
});
152152

153-
after(() =>
154-
AV.request({
155-
method: 'DELETE',
156-
path: `/leaderboard/leaderboards/${statisticName}`,
157-
authOptions: {
158-
useMasterKey: true,
159-
},
160-
})
161-
);
153+
after(function() {
154+
return this.leaderboard.destroy({ useMasterKey: true });
155+
});
162156
});

0 commit comments

Comments
 (0)