From 09311c7dab5ecef5cf5b335696b2c4cf909141a3 Mon Sep 17 00:00:00 2001 From: Joffrey JAFFEUX Date: Thu, 18 Apr 2024 09:54:23 +0200 Subject: [PATCH] DEV: minimum fabricators for post/topic (#26671) I will add new default properties as needed in the future, but for now this is enough to have an entry point. --- .../javascripts/discourse/app/lib/fabricators.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/app/assets/javascripts/discourse/app/lib/fabricators.js b/app/assets/javascripts/discourse/app/lib/fabricators.js index f9c077291b7..557f65ee650 100644 --- a/app/assets/javascripts/discourse/app/lib/fabricators.js +++ b/app/assets/javascripts/discourse/app/lib/fabricators.js @@ -29,6 +29,20 @@ export default class CoreFabricators { setOwner(this, owner); } + post(args = {}) { + return this.store.createRecord("post", { + id: args.id || incrementSequence(), + topic: args.topic || this.topic(), + }); + } + + topic(args = {}) { + return this.store.createRecord("topic", { + id: args.id || incrementSequence(), + title: args.title || getLoadedFaker().faker.commerce.productName(), + }); + } + category(args = {}) { const name = args.name || getLoadedFaker().faker.commerce.product();