Fixed toJSON method of Tier
This was returning an ObjectID object which is not a JSON primitive
This commit is contained in:
parent
6e862b42e7
commit
df145797b3
@ -186,7 +186,7 @@ module.exports = class Tier {
|
||||
|
||||
toJSON() {
|
||||
return {
|
||||
id: this.#id,
|
||||
id: this.#id.toHexString(),
|
||||
slug: this.#slug,
|
||||
name: this.#name,
|
||||
description: this.#description,
|
||||
|
@ -99,7 +99,6 @@ describe('Tier', function () {
|
||||
const tier = await Tier.create(validInput);
|
||||
|
||||
const expectedProps = [
|
||||
'id',
|
||||
'slug',
|
||||
'name',
|
||||
'description',
|
||||
@ -119,6 +118,7 @@ describe('Tier', function () {
|
||||
for (const prop of expectedProps) {
|
||||
assert(tier[prop] === tier.toJSON()[prop]);
|
||||
}
|
||||
assert(tier.id.toHexString() === tier.toJSON().id);
|
||||
});
|
||||
|
||||
it('Errors when attempting to set invalid properties', async function () {
|
||||
|
Loading…
Reference in New Issue
Block a user