Skip to content

Commit

Permalink
Merge pull request #145 from DIMO-Network/chore/si-2666-add-manufactu…
Browse files Browse the repository at this point in the history
…rertableset-event

Chore/si 2666 add manufacturertableset event
  • Loading branch information
LorranSutter committed Jun 11, 2024
2 parents 900d40f + fde32e9 commit 00456cd
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
2 changes: 2 additions & 0 deletions contracts/implementations/tableland/DeviceDefinitionTable.sol
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ contract DeviceDefinitionTable is AccessControlInternal {
dds.tables[manufacturerId] = tableId;

emit DeviceDefinitionTableCreated(tableOwner, manufacturerId, tableId);
emit ManufacturerTableSet(manufacturerId, tableId);
}

/**
Expand Down Expand Up @@ -163,6 +164,7 @@ contract DeviceDefinitionTable is AccessControlInternal {
manufacturerIds[i],
tableId
);
emit ManufacturerTableSet(manufacturerIds[i], tableId);
}
}

Expand Down
44 changes: 44 additions & 0 deletions test/tableland/DeviceDefinitionTable.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,15 @@ describe('DeviceDefinitionTable', async function () {
.to.emit(ddTableInstance, 'DeviceDefinitionTableCreated')
.withArgs(manufacturer1.address, 1, 2);
});
it('Should emit ManufacturerTableSet event with correct params', async () => {
await expect(
ddTableInstance
.connect(admin)
.createDeviceDefinitionTable(manufacturer1.address, 1)
)
.to.emit(ddTableInstance, 'ManufacturerTableSet')
.withArgs(1, 2);
});
});
});

Expand Down Expand Up @@ -281,6 +290,15 @@ describe('DeviceDefinitionTable', async function () {
.to.emit(ddTableInstance, 'DeviceDefinitionTableCreated')
.withArgs(manufacturer1.address, 1, 2);
});
it('Should emit ManufacturerTableSet event with correct params', async () => {
await expect(
ddTableInstance
.connect(manufacturer1)
.createDeviceDefinitionTable(manufacturer1.address, 1)
)
.to.emit(ddTableInstance, 'ManufacturerTableSet')
.withArgs(1, 2);
});
});
});
});
Expand Down Expand Up @@ -381,6 +399,19 @@ describe('DeviceDefinitionTable', async function () {
.to.emit(ddTableInstance, 'DeviceDefinitionTableCreated')
.withArgs(admin.address, 3, 4);
});
it('Should emit ManufacturerTableSet event with correct params', async () => {
await expect(
ddTableInstance
.connect(admin)
.createDeviceDefinitionTableBatch(admin.address, [1, 2, 3])
)
.to.emit(ddTableInstance, 'ManufacturerTableSet')
.withArgs(1, 2)
.to.emit(ddTableInstance, 'ManufacturerTableSet')
.withArgs(2, 3)
.to.emit(ddTableInstance, 'ManufacturerTableSet')
.withArgs(3, 4);
});
});
});

Expand Down Expand Up @@ -460,6 +491,19 @@ describe('DeviceDefinitionTable', async function () {
.to.emit(ddTableInstance, 'DeviceDefinitionTableCreated')
.withArgs(manufacturerAdmin.address, 6, 4);
});
it('Should emit ManufacturerTableSet event with correct params', async () => {
await expect(
ddTableInstance
.connect(manufacturerAdmin)
.createDeviceDefinitionTableBatch(manufacturerAdmin.address, [4, 5, 6])
)
.to.emit(ddTableInstance, 'ManufacturerTableSet')
.withArgs(4, 2)
.to.emit(ddTableInstance, 'ManufacturerTableSet')
.withArgs(5, 3)
.to.emit(ddTableInstance, 'ManufacturerTableSet')
.withArgs(6, 4);
});
});
});
});
Expand Down

0 comments on commit 00456cd

Please sign in to comment.