Skip to content

Commit

Permalink
Stick to general actual and expected in trait tests
Browse files Browse the repository at this point in the history
  • Loading branch information
BowTiedRadone committed Jan 21, 2025
1 parent 1d76720 commit 2b837d9
Showing 1 changed file with 45 additions and 45 deletions.
90 changes: 45 additions & 45 deletions traits.tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,61 +17,61 @@ describe("Trait reference processing", () => {
const allFunctionsInterfaces = testInputs.directTrait1stParameter
.functionsInterfaces as ContractInterfaceFunction[];

const expectedTraitReferenceMap = new Map(
const expected = new Map(
Object.entries({
"test-trait": { token: "trait_reference" },
})
);

// Act
const traitReferenceMap = buildTraitReferenceMap(allFunctionsInterfaces);
const actual = buildTraitReferenceMap(allFunctionsInterfaces);

// Assert
expect(traitReferenceMap).toEqual(expectedTraitReferenceMap);
expect(actual).toEqual(expected);
});

it("correctly builds the trait reference map for a direct trait that is the second parameter", () => {
// Arrange
const allFunctionsInterfaces = testInputs.directTrait2ndParameter
.functionsInterfaces as ContractInterfaceFunction[];

const expectedTraitReferenceMap = new Map(
const expected = new Map(
Object.entries({
"test-trait": { token: "trait_reference" },
})
);

// Act
const traitReferenceMap = buildTraitReferenceMap(allFunctionsInterfaces);
const actual = buildTraitReferenceMap(allFunctionsInterfaces);

// Assert
expect(traitReferenceMap).toEqual(expectedTraitReferenceMap);
expect(actual).toEqual(expected);
});

it("correctly builds the trait reference map for a direct trait that is the fifth parameter", () => {
// Arrange
const allFunctionsInterfaces = testInputs.directTrait5thParameter
.functionsInterfaces as ContractInterfaceFunction[];

const expectedTraitReferenceMap = new Map(
const expected = new Map(
Object.entries({
"test-trait": { e: "trait_reference" },
})
);

// Act
const traitReferenceMap = buildTraitReferenceMap(allFunctionsInterfaces);
const actual = buildTraitReferenceMap(allFunctionsInterfaces);

// Assert
expect(traitReferenceMap).toEqual(expectedTraitReferenceMap);
expect(actual).toEqual(expected);
});

it("correctly builds the trait reference map for a tuple nested trait that is the first parameter", () => {
// Arrange
const allFunctionsInterfaces = testInputs.tupleTraitParameter
.functionsInterfaces as ContractInterfaceFunction[];

const expectedTraitReferenceMap = new Map(
const expected = new Map(
Object.entries({
"test-trait": {
"tuple-param": { tuple: { token: "trait_reference" } },
Expand All @@ -80,18 +80,18 @@ describe("Trait reference processing", () => {
);

// Act
const traitReferenceMap = buildTraitReferenceMap(allFunctionsInterfaces);
const actual = buildTraitReferenceMap(allFunctionsInterfaces);

// Assert
expect(traitReferenceMap).toEqual(expectedTraitReferenceMap);
expect(actual).toEqual(expected);
});

it("correctly builds the trait reference map for a list nested trait", () => {
// Arrange
const allFunctionsInterfaces = testInputs.listTraitParameter
.functionsInterfaces as ContractInterfaceFunction[];

const expectedTraitReferenceMap = new Map(
const expected = new Map(
Object.entries({
"test-trait": {
"token-list": { list: { undefined: "trait_reference" } },
Expand All @@ -100,18 +100,18 @@ describe("Trait reference processing", () => {
);

// Act
const traitReferenceMap = buildTraitReferenceMap(allFunctionsInterfaces);
const actual = buildTraitReferenceMap(allFunctionsInterfaces);

// Assert
expect(traitReferenceMap).toEqual(expectedTraitReferenceMap);
expect(actual).toEqual(expected);
});

it("correctly builds the trait reference map for a response ok branch nested trait", () => {
// Arrange
const allFunctionsInterfaces = testInputs.responseOkTraitParameter
.functionsInterfaces as ContractInterfaceFunction[];

const expectedTraitReferenceMap = new Map(
const expected = new Map(
Object.entries({
"test-trait": {
"resp-trait-param": { response: { ok: "trait_reference" } },
Expand All @@ -120,18 +120,18 @@ describe("Trait reference processing", () => {
);

// Act
const traitReferenceMap = buildTraitReferenceMap(allFunctionsInterfaces);
const actual = buildTraitReferenceMap(allFunctionsInterfaces);

// Assert
expect(traitReferenceMap).toEqual(expectedTraitReferenceMap);
expect(actual).toEqual(expected);
});

it("correctly builds the trait reference map for a response error branch nested trait", () => {
// Arrange
const allFunctionsInterfaces = testInputs.responseErrTraitParameter
.functionsInterfaces as ContractInterfaceFunction[];

const expectedTraitReferenceMap = new Map(
const expected = new Map(
Object.entries({
"test-trait": {
"resp-trait-param": { response: { error: "trait_reference" } },
Expand All @@ -140,18 +140,18 @@ describe("Trait reference processing", () => {
);

// Act
const traitReferenceMap = buildTraitReferenceMap(allFunctionsInterfaces);
const actual = buildTraitReferenceMap(allFunctionsInterfaces);

// Assert
expect(traitReferenceMap).toEqual(expectedTraitReferenceMap);
expect(actual).toEqual(expected);
});

it("correctly builds the trait reference map for a response both branches nested trait", () => {
// Arrange
const allFunctionsInterfaces = testInputs.responseBothTraitParameter
.functionsInterfaces as ContractInterfaceFunction[];

const expectedTraitReferenceMap = new Map(
const expected = new Map(
Object.entries({
"test-trait": {
"resp-trait-param": {
Expand All @@ -162,18 +162,18 @@ describe("Trait reference processing", () => {
);

// Act
const traitReferenceMap = buildTraitReferenceMap(allFunctionsInterfaces);
const actual = buildTraitReferenceMap(allFunctionsInterfaces);

// Assert
expect(traitReferenceMap).toEqual(expectedTraitReferenceMap);
expect(actual).toEqual(expected);
});

it("correctly builds the trait reference map for an optional nested trait", () => {
// Arrange
const allFunctionsInterfaces = testInputs.optionalTraitParameter
.functionsInterfaces as ContractInterfaceFunction[];

const expectedTraitReferenceMap = new Map(
const expected = new Map(
Object.entries({
"test-trait": {
"opt-trait": {
Expand All @@ -184,10 +184,10 @@ describe("Trait reference processing", () => {
);

// Act
const traitReferenceMap = buildTraitReferenceMap(allFunctionsInterfaces);
const actual = buildTraitReferenceMap(allFunctionsInterfaces);

// Assert
expect(traitReferenceMap).toEqual(expectedTraitReferenceMap);
expect(actual).toEqual(expected);
});

it("correctly enriches interface with trait reference data for a direct trait that is the first parameter", () => {
Expand Down Expand Up @@ -274,15 +274,15 @@ describe("Trait reference processing", () => {
);

// Act
const enrichedTestFunctionsInterfacesMap = enrichInterfaceWithTraitData(
const actual = enrichInterfaceWithTraitData(
ast,
traitReferenceMap,
allFunctionsInterfaces,
targetContractId
);

// Assert
expect(enrichedTestFunctionsInterfacesMap).toEqual(expected);
expect(actual).toEqual(expected);
});

it("correctly enriches interface with trait reference data for a direct trait that is the second parameter", () => {
Expand Down Expand Up @@ -370,15 +370,15 @@ describe("Trait reference processing", () => {
);

// Act
const enrichedTestFunctionsInterfacesMap = enrichInterfaceWithTraitData(
const actual = enrichInterfaceWithTraitData(
ast,
traitReferenceMap,
allFunctionsInterfaces,
targetContractId
);

// Assert
expect(enrichedTestFunctionsInterfacesMap).toEqual(expected);
expect(actual).toEqual(expected);
});

it("correctly enriches interface with trait reference data for a direct trait that is the fifth parameter", () => {
Expand Down Expand Up @@ -476,15 +476,15 @@ describe("Trait reference processing", () => {
);

// Act
const enrichedTestFunctionsInterfacesMap = enrichInterfaceWithTraitData(
const actual = enrichInterfaceWithTraitData(
ast,
traitReferenceMap,
allFunctionsInterfaces,
targetContractId
);

// Assert
expect(enrichedTestFunctionsInterfacesMap).toEqual(expected);
expect(actual).toEqual(expected);
});

it("correctly enriches interface with trait reference data for a tuple nested trait that is the first parameter", () => {
Expand Down Expand Up @@ -577,15 +577,15 @@ describe("Trait reference processing", () => {
);

// Act
const enrichedTestFunctionsInterfacesMap = enrichInterfaceWithTraitData(
const actual = enrichInterfaceWithTraitData(
ast,
traitReferenceMap,
allFunctionsInterfaces,
targetContractId
);

// Assert
expect(enrichedTestFunctionsInterfacesMap).toEqual(expected);
expect(actual).toEqual(expected);
});

it("correctly enriches interface with trait reference data for a list nested trait", () => {
Expand Down Expand Up @@ -677,15 +677,15 @@ describe("Trait reference processing", () => {
);

// Act
const enrichedTestFunctionsInterfacesMap = enrichInterfaceWithTraitData(
const actual = enrichInterfaceWithTraitData(
ast,
traitReferenceMap,
allFunctionsInterfaces,
targetContractId
);

// Assert
expect(enrichedTestFunctionsInterfacesMap).toEqual(expected);
expect(actual).toEqual(expected);
});

it("correctly enriches interface with trait reference data for a response ok branch nested trait", () => {
Expand Down Expand Up @@ -777,15 +777,15 @@ describe("Trait reference processing", () => {
);

// Act
const enrichedTestFunctionsInterfacesMap = enrichInterfaceWithTraitData(
const actual = enrichInterfaceWithTraitData(
ast,
traitReferenceMap,
allFunctionsInterfaces,
targetContractId
);

// Assert
expect(enrichedTestFunctionsInterfacesMap).toEqual(expected);
expect(actual).toEqual(expected);
});

it("correctly enriches interface with trait reference data for a response error branch nested trait", () => {
Expand Down Expand Up @@ -877,15 +877,15 @@ describe("Trait reference processing", () => {
);

// Act
const enrichedTestFunctionsInterfacesMap = enrichInterfaceWithTraitData(
const actual = enrichInterfaceWithTraitData(
ast,
traitReferenceMap,
allFunctionsInterfaces,
targetContractId
);

// Assert
expect(enrichedTestFunctionsInterfacesMap).toEqual(expected);
expect(actual).toEqual(expected);
});

it("correctly enriches interface with trait reference data for a response both branches nested trait", () => {
Expand Down Expand Up @@ -997,15 +997,15 @@ describe("Trait reference processing", () => {
);

// Act
const enrichedTestFunctionsInterfacesMap = enrichInterfaceWithTraitData(
const actual = enrichInterfaceWithTraitData(
ast,
traitReferenceMap,
allFunctionsInterfaces,
targetContractId
);

// Assert
expect(enrichedTestFunctionsInterfacesMap).toEqual(expected);
expect(actual).toEqual(expected);
});

it("correctly enriches interface with trait reference data for a optional nested trait", () => {
Expand Down Expand Up @@ -1094,15 +1094,15 @@ describe("Trait reference processing", () => {
);

// Act
const enrichedTestFunctionsInterfacesMap = enrichInterfaceWithTraitData(
const actual = enrichInterfaceWithTraitData(
ast,
traitReferenceMap,
allFunctionsInterfaces,
targetContractId
);

// Assert
expect(enrichedTestFunctionsInterfacesMap).toEqual(expected);
expect(actual).toEqual(expected);
});

it("correctly retrieves the contracts implementing a trait from the Clarinet project", async () => {
Expand Down

0 comments on commit 2b837d9

Please sign in to comment.