Skip to content

Commit

Permalink
Merge pull request #1419 from folio-org/CIRC-1988b
Browse files Browse the repository at this point in the history
CIRC-1988 Unit tests for DCB changes
  • Loading branch information
MagzhanArtykov authored Jan 8, 2024
2 parents 3c8ca4f + cf05297 commit 436727e
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
32 changes: 32 additions & 0 deletions src/test/java/api/loans/CheckOutByBarcodeTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -960,6 +960,38 @@ void canCheckOutOnOrderItemWithRequest() {
assertThat(checkedOutSmallAngryPlanet, hasItemStatus(CHECKED_OUT));
}

@Test
void canCheckOutAnDcbItem() {
IndividualResource instance = instancesFixture.basedUponDunkirk();
IndividualResource holdings = holdingsFixture.defaultWithHoldings(instance.getId());
IndividualResource locationsResource = locationsFixture.mainFloor();
var barcode = "100002222";
IndividualResource circulationItem = circulationItemsFixture.createCirculationItem(barcode, holdings.getId(), locationsResource.getId());
final IndividualResource jessica = usersFixture.jessica();
final IndividualResource response = checkOutFixture.checkOutByBarcode(
new CheckOutByBarcodeRequestBuilder()
.forItem(circulationItem)
.to(jessica)
.at(servicePointsFixture.cd1()));

final JsonObject loan = response.getJson();

assertThat(loan.getString("id"), is(notNullValue()));

assertThat("user ID should match barcode",
loan.getString("userId"), is(jessica.getId()));

assertThat("item ID should match barcode",
loan.getString("itemId"), is(circulationItem.getId()));

assertThat("status should be open",
loan.getJsonObject("status").getString("name"), is("Open"));

circulationItem = circulationItemsClient.get(circulationItem);

assertThat(circulationItem, hasItemStatus(CHECKED_OUT));
}

@Test
void canCheckOutInProcessItem() {

Expand Down
1 change: 1 addition & 0 deletions src/test/java/api/support/APITests.java
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ public abstract class APITests {
protected final ResourceClient instancesClient = ResourceClient.forInstances();
protected final ResourceClient holdingsClient = ResourceClient.forHoldings();
protected final ResourceClient itemsClient = ResourceClient.forItems();
protected final ResourceClient circulationItemsClient = ResourceClient.forCirculationItem();

protected final ResourceClient loansClient = ResourceClient.forLoans();
protected final ResourceClient accountsClient = ResourceClient.forAccounts();
Expand Down

0 comments on commit 436727e

Please sign in to comment.