chore: Cleanup utils package (#9238)

Fixes: FRMW-2712

Old PR: https://github.com/medusajs/medusa/pull/9234 Closed because of incorrect branch naming

Co-authored-by: Adrien de Peretti <25098370+adrien2p@users.noreply.github.com>
This commit is contained in:
Harminder Virk
2024-09-23 10:37:58 +00:00
committed by GitHub
co-authored by Adrien de Peretti
parent 79e3578932
commit 97e003ef4f
17 changed files with 138 additions and 75 deletions
@@ -8,7 +8,7 @@ describe("MessageAggregator", function () {
it("should group messages by any given group of keys", function () {
const aggregator = new MessageAggregator()
aggregator.save({
eventName: "ProductVariant.created",
name: "ProductVariant.created",
metadata: {
source: "Product",
action: "created",
@@ -18,7 +18,7 @@ describe("MessageAggregator", function () {
data: { id: 999 },
})
aggregator.save({
eventName: "Product.created",
name: "Product.created",
metadata: {
source: "Product",
action: "created",
@@ -28,7 +28,7 @@ describe("MessageAggregator", function () {
data: { id: 1 },
})
aggregator.save({
eventName: "ProductVariant.created",
name: "ProductVariant.created",
metadata: {
source: "Product",
action: "created",
@@ -38,7 +38,7 @@ describe("MessageAggregator", function () {
data: { id: 222 },
})
aggregator.save({
eventName: "ProductType.detached",
name: "ProductType.detached",
metadata: {
source: "Product",
action: "detached",
@@ -48,7 +48,7 @@ describe("MessageAggregator", function () {
data: { id: 333 },
})
aggregator.save({
eventName: "ProductVariant.updated",
name: "ProductVariant.updated",
metadata: {
source: "Product",
action: "updated",
@@ -59,7 +59,7 @@ describe("MessageAggregator", function () {
})
const format = {
groupBy: ["eventName", "metadata.object", "metadata.action"],
groupBy: ["name", "metadata.object", "metadata.action"],
sortBy: {
"metadata.object": ["ProductType", "ProductVariant", "Product"],
"data.id": "asc",
@@ -74,7 +74,7 @@ describe("MessageAggregator", function () {
expect(allGroups[0]).toEqual([
{
eventName: "ProductType.detached",
name: "ProductType.detached",
metadata: {
source: "Product",
action: "detached",
@@ -87,7 +87,7 @@ describe("MessageAggregator", function () {
expect(allGroups[1]).toEqual([
{
eventName: "ProductVariant.updated",
name: "ProductVariant.updated",
metadata: {
source: "Product",
action: "updated",
@@ -100,7 +100,7 @@ describe("MessageAggregator", function () {
expect(allGroups[2]).toEqual([
{
eventName: "ProductVariant.created",
name: "ProductVariant.created",
metadata: {
source: "Product",
action: "created",
@@ -110,7 +110,7 @@ describe("MessageAggregator", function () {
data: { id: 222 },
},
{
eventName: "ProductVariant.created",
name: "ProductVariant.created",
metadata: {
source: "Product",
action: "created",
@@ -123,7 +123,7 @@ describe("MessageAggregator", function () {
expect(allGroups[3]).toEqual([
{
eventName: "Product.created",
name: "Product.created",
metadata: {
source: "Product",
action: "created",