Skip to content

Commit

Permalink
Fix some tests
Browse files Browse the repository at this point in the history
RISDEV-2902
  • Loading branch information
rvp-c committed Dec 6, 2023
1 parent 1044a47 commit f4b6fb9
Show file tree
Hide file tree
Showing 11 changed files with 24 additions and 41 deletions.
2 changes: 1 addition & 1 deletion .talismanrc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ fileignoreconfig:
- filename: backend/src/main/kotlin/de/bund/digitalservice/ris/norms/framework/adapter/input/restapi/controller/GetFileController.kt
checksum: f989b3c9c176b1b985c2f78ca6ca13fa1403cbb69f367ae9b1cb8ea64d5f6747
- filename: backend/src/test/java/de/bund/digitalservice/ris/caselaw/integration/tests/JurisXmlExporterWrapperIntegrationTest.java
checksum: d8750cb58c1bf1206620c0537ac5f355ea4b0372888692784f57beae1316a831
checksum: c2bd47d6fd5b51d674e888ad09bf004a84ad0de5b59e151bc0fd62c05a1349bd
- filename: backend/src/test/java/de/bund/digitalservice/ris/caselaw/integration/tests/DeviatingObjectIntegrationTest.java
checksum: 120c5e4fd9ec2f1930e7b0b6c0256ebf418c770060f986838521d71725963a24
- filename: backend/src/test/kotlin/unit/adapter/input/restapi/controller/GenerateNormFileControllerTest.kt
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
import java.time.LocalDate;
import java.util.UUID;
import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
import lombok.EqualsAndHashCode.Include;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
Expand All @@ -25,11 +27,12 @@
@NoArgsConstructor
@SuperBuilder
@Entity
@EqualsAndHashCode(onlyExplicitlyIncluded = true)
@Table(schema = "incremental_migration", name = "related_documentation")
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
public abstract class RelatedDocumentationDTO {

@Id @GeneratedValue private UUID id;
@Include @Id @GeneratedValue private UUID id;

@ManyToOne private CourtDTO court;

Expand All @@ -55,6 +58,7 @@ public abstract class RelatedDocumentationDTO {
@JoinColumn(name = "document_number", referencedColumnName = "document_number")
private DocumentationUnitDTO referencedDocumentationUnit;

@Include
@Column(name = "document_number", insertable = false, updatable = false)
private String documentNumber;
}
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ void testUpdateDocumentUnit_addNewActiveCitation() {
.build())
.build(),
ActiveCitation.builder()
.uuid(UUID.fromString("7da39a1e-78a9-11ee-b962-0242ac120002"))
.uuid(UUID.fromString("7da39a1e-78a9-11ee-b962-0242ac120003"))
.citationType(
CitationType.builder()
.uuid(
Expand Down Expand Up @@ -1117,8 +1117,6 @@ void testUpdateDocumentationUnit_addLinkedActiveCitation() {
ActiveCitation.builder()
.uuid(UUID.randomUUID())
.documentNumber("documentnr002")
.referencedDocumentationUnitId(
UUID.fromString("f13e7fe2-78a5-11ee-b962-0242ac120002"))
.build()))
.build())
.build();
Expand Down Expand Up @@ -1172,14 +1170,10 @@ void testUpdateDocumentationUnit_shouldNotAddSameLinkedActiveCitationTwice() {
ActiveCitation.builder()
.uuid(activeCitationUUID2)
.documentNumber("documentnr002")
.referencedDocumentationUnitId(
UUID.fromString("f13e7fe2-78a5-11ee-b962-0242ac120002"))
.build(),
ActiveCitation.builder()
.uuid(activeCitationUUID2)
.documentNumber("documentnr002")
.referencedDocumentationUnitId(
UUID.fromString("f13e7fe2-78a5-11ee-b962-0242ac120002"))
.build()))
.build())
.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -890,8 +890,6 @@ void testUpdateDocumentationUnit_addLinkedEnsuingDecision() {
EnsuingDecision.builder()
.uuid(UUID.randomUUID())
.documentNumber("documentnr002")
.referencedDocumentationUnitId(
UUID.fromString("f13e7fe2-78a5-11ee-b962-0242ac120002"))
.build()))
.build();

Expand Down Expand Up @@ -924,14 +922,10 @@ void testUpdateDocumentationUnit_shouldNotAddSameLinkedDecisionTwice() {
EnsuingDecision.builder()
.uuid(UUID.fromString("f0232240-7416-11ee-b962-0242ac120002"))
.documentNumber("documentnr002")
.referencedDocumentationUnitId(
UUID.fromString("f13e7fe2-78a5-11ee-b962-0242ac120002"))
.build(),
EnsuingDecision.builder()
.uuid(UUID.fromString("f0232240-7416-11ee-b962-0242ac120002"))
.documentNumber("documentnr002")
.referencedDocumentationUnitId(
UUID.fromString("f13e7fe2-78a5-11ee-b962-0242ac120002"))
.build()))
.build();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,6 @@ void testDocumentUnitIsSyncedWithModel()
PreviousDecision.builder()
.uuid(UUID.randomUUID())
.documentNumber("documentNumber")
.referencedDocumentationUnitId(UUID.randomUUID())
.uuid(UUID.randomUUID())
.court(new Court(UUID.randomUUID(), "courtType", "courtPlace", "courtLabel", null))
.decisionDate(LocalDate.parse("2020-04-05"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ void testLinkExistingPreviousDecision() {
.previousDecisions(
List.of(
PreviousDecision.builder()
.referencedDocumentationUnitId(childDocumentationUnitUuid)
.uuid(childDocumentationUnitUuid)
.documentNumber(childDocumentUnitDTO.getDocumentNumber())
.build()))
.coreData(CoreData.builder().documentationOffice(docOffice).build())
Expand All @@ -245,8 +245,8 @@ void testLinkExistingPreviousDecision() {
.consumeWith(
response -> {
assertThat(response.getResponseBody().previousDecisions())
.extracting("referencedDocumentationUnitId")
.containsExactly(childDocumentationUnitUuid);
.extracting("documentNumber")
.containsExactly("abcdefghjikl");
});
}

Expand Down Expand Up @@ -308,12 +308,12 @@ void testLinkTheSameDocumentUnitsTwice() {
.previousDecisions(
List.of(
PreviousDecision.builder()
.uuid(childDocumentationUnitUuid)
.documentNumber("xxx")
.referencedDocumentationUnitId(childDocumentationUnitUuid)
.build(),
PreviousDecision.builder()
.uuid(childDocumentationUnitUuid)
.documentNumber("xxx")
.referencedDocumentationUnitId(childDocumentationUnitUuid)
.build()))
.coreData(CoreData.builder().documentationOffice(docOffice).build())
.build();
Expand All @@ -333,9 +333,6 @@ void testLinkTheSameDocumentUnitsTwice() {
assertThat(response.getResponseBody().previousDecisions().get(0))
.extracting("documentNumber")
.isEqualTo("xxx");
assertThat(response.getResponseBody().previousDecisions().get(0))
.extracting("referencedDocumentationUnitId")
.isEqualTo(childDocumentationUnitUuid);
});
}

Expand Down
4 changes: 1 addition & 3 deletions frontend/test/components/InlineDecision.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ function renderComponent(options?: {
decisionDate:
options?.decisionDate ?? "2004-12-02 12:00:00.000000 +00:00",
documentNumber: options?.documentNumber ?? undefined,
referencedDocumentationUnitId:
options?.referencedDocumentationUnitId ?? undefined,
referenceFound: true,
},
}),
}
Expand Down Expand Up @@ -80,7 +79,6 @@ describe("Decision ListItem", () => {
it("renders with link if linked to docunit", async () => {
renderComponent({
documentNumber: "fooDocumentNumber",
referencedDocumentationUnitId: "abc",
})
expect(screen.getByRole("link")).toHaveAttribute(
"href",
Expand Down
9 changes: 4 additions & 5 deletions frontend/test/components/activeCitations.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function renderComponent(options?: { modelValue?: ActiveCitation[] }) {
function generateActiveCitation(options?: {
uuid?: string
documentNumber?: string
referencedDocumentationUnitId?: string
referenceFound?: boolean
court?: Court
decisionDate?: string
fileNumber?: string
Expand All @@ -40,8 +40,6 @@ function generateActiveCitation(options?: {
const activeCitation = new ActiveCitation({
uuid: options?.uuid ?? "123",
documentNumber: options?.documentNumber ?? undefined,
referencedDocumentationUnitId:
options?.referencedDocumentationUnitId ?? undefined,
court: options?.court ?? {
type: "type1",
location: "location1",
Expand All @@ -58,6 +56,7 @@ function generateActiveCitation(options?: {
jurisShortcut: "Änderungen",
label: "Änderungen",
},
referenceFound: options?.referenceFound ?? false,
})
return activeCitation
}
Expand Down Expand Up @@ -406,7 +405,7 @@ describe("Active Citations", () => {
modelValue: [
generateActiveCitation({
documentNumber: "ABC",
referencedDocumentationUnitId: "abc",
referenceFound: true,
}),
],
})
Expand Down Expand Up @@ -489,7 +488,7 @@ describe("Active Citations", () => {
modelValue: [
generateActiveCitation({
documentNumber: "123",
referencedDocumentationUnitId: "123",
referenceFound: true,
citationStyle: {
label: "invalid",
},
Expand Down
7 changes: 3 additions & 4 deletions frontend/test/components/ensuingDecisions.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function generateEnsuingDecision(options?: {
decisionDate?: string
fileNumber?: string
documentType?: DocumentType
referencedDocumentationUnitId?: string
referenceFound?: boolean
pending?: boolean
note?: string
}) {
Expand All @@ -51,8 +51,7 @@ function generateEnsuingDecision(options?: {
jurisShortcut: "documentTypeShortcut1",
label: "documentType1",
},
referencedDocumentationUnitId:
options?.referencedDocumentationUnitId ?? undefined,
referenceFound: options?.referenceFound ?? false,
pending: options?.pending ?? false,
note: options?.note ?? undefined,
})
Expand Down Expand Up @@ -298,7 +297,7 @@ describe("EnsuingDecisions", () => {
modelValue: [
generateEnsuingDecision({
documentNumber: "ABC",
referencedDocumentationUnitId: "abc",
referenceFound: true,
}),
],
})
Expand Down
7 changes: 3 additions & 4 deletions frontend/test/components/previousDecisions.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,12 @@ function generatePreviousDecision(options?: {
fileNumber?: string
documentType?: DocumentType
dateKnown?: boolean
referencedDocumentationUnitId?: string
referenceFound?: boolean
}) {
const previousDecision = new PreviousDecision({
uuid: options?.uuid ?? "123",
documentNumber: options?.documentNumber ?? undefined,
referencedDocumentationUnitId:
options?.referencedDocumentationUnitId ?? undefined,
referenceFound: options?.referenceFound ?? false,
court: options?.court ?? {
type: "type1",
location: "location1",
Expand Down Expand Up @@ -356,7 +355,7 @@ describe("PreviousDecisions", () => {
modelValue: [
generatePreviousDecision({
documentNumber: "ABC",
referencedDocumentationUnitId: "abc",
referenceFound: true,
}),
],
})
Expand Down
2 changes: 1 addition & 1 deletion frontend/test/domain/proceedingDecision.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ describe("ProceedingDecision", () => {
it("returns true if linked to other docunit", () => {
const proceedingDecision = new ProceedingDecision({
documentNumber: "ABC",
referencedDocumentationUnitId: "abc",
referenceFound: true,
})
expect(proceedingDecision.isReadOnly).toBeTruthy()
})
Expand Down

0 comments on commit f4b6fb9

Please sign in to comment.