Skip to content

Commit

Permalink
Improve test.each test name individualisation (#412)
Browse files Browse the repository at this point in the history
* test: show correct test names in test.each

* test: correct more usages

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
  • Loading branch information
Magnus-Kuhn and mergify[bot] authored Feb 10, 2025
1 parent 004efe2 commit be35b61
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ describe("DecideRequestParametersValidator", function () {
}
];

test.each([...successParams, ...errorParams])("${value.description}", async function (data) {
test.each([...successParams, ...errorParams])("$description", async function (data) {
const localRequest = LocalRequest.from({
id: CoreId.from(requestId),
content: data.input.request,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ describe("CreateAttributeRequestItemProcessor", function () {

describe("applyIncomingResponseItem", function () {
test.each([TestIdentity.PEER, TestIdentity.EMPTY])(
"in case of an IdentityAttribute with owner=${value.toString()}: creates a LocalAttribute with the Attribute from the RequestItem and the attributeId from the ResponseItem for the peer of the request ",
"in case of an IdentityAttribute with owner=%s: creates a LocalAttribute with the Attribute from the RequestItem and the attributeId from the ResponseItem for the peer of the request ",
async function (attributeOwner: CoreAddress) {
await Given.aRequestItemWithAnIdentityAttribute({ attributeOwner });
await Given.aCreateAttributeAcceptResponseItem();
Expand All @@ -430,7 +430,7 @@ describe("CreateAttributeRequestItemProcessor", function () {
);

test.each([TestIdentity.PEER, TestIdentity.EMPTY, TestIdentity.CURRENT_IDENTITY])(
"in case of a RelationshipAttribute with owner=${value.toString()}: creates a LocalAttribute with the Attribute from the RequestItem and the attributeId from the ResponseItem for the peer of the request ",
"in case of a RelationshipAttribute with owner=%s: creates a LocalAttribute with the Attribute from the RequestItem and the attributeId from the ResponseItem for the peer of the request ",
async function (attributeOwner: CoreAddress) {
await Given.aRequestItemWithARelationshipAttribute({ attributeOwner });
await Given.aCreateAttributeAcceptResponseItem();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ describe("ShareAttributeRequestItemProcessor", function () {
message: "It doesn't make sense to share a RelationshipAttribute with its owner."
}
}
])("returns ${value.result} when passing ${value.scenario}", async function (testParams) {
])("returns $result when passing $scenario", async function (testParams) {
const sender = testAccount.identity.address;
const recipient = CoreAddress.from("Recipient");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ describe("ProprietaryJSON", function () {
}
}
])(
"(de-)serialize %p",
"(de-)serialize %j",

function (value: any) {
const prop = ProprietaryJSON.from({ title: "a-title", value });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ describe("RelationshipAttributeHints", function () {
expect(creationHints).toBeInstanceOf(RelationshipAttributeCreationHints);
});

test.each(["", "non-existing-value-type"])("should validate valueType ('${value}' should be invalid)", function (invalidValueType) {
test.each(["", "non-existing-value-type"])("should validate valueType ('%s' should be invalid)", function (invalidValueType) {
expect(() =>
RelationshipAttributeCreationHints.from({
// @ts-expect-error
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ describe("ThirdPartyRelationshipAttributeQuery", function () {
{ in: { address: "test" }, out: ["test"] },
{ in: [{ address: "test" }], out: ["test"] },
{ in: [{ address: "test" }, { address: "test" }], out: ["test", "test"] }
])("accepts '$in' as thirdParty", function (params) {
])("accepts %j as thirdParty", function (params) {
const serialized = ThirdPartyRelationshipAttributeQuery.from({
key: "test",
owner: "thirdParty",
Expand Down Expand Up @@ -64,7 +64,7 @@ describe("ThirdPartyRelationshipAttributeQuery", function () {
{ in: "test", out: ["test"] },
{ in: ["test"], out: ["test"] }
])(
"(de-)serialize ThirdPartyRelationshipAttributeQuery as a property with ${JSON.stringify(value)} as thirdParty",
"(de-)serialize ThirdPartyRelationshipAttributeQuery as a property with %j as thirdParty",

function (params) {
const test = TestTypeContainingThirdPartyRelationshipAttributeQueryTest.from({
Expand Down

0 comments on commit be35b61

Please sign in to comment.