Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
Doom9527 committed Jul 16, 2024
1 parent cc7a0b0 commit 75cd6d6
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 17 deletions.
18 changes: 10 additions & 8 deletions src/test/java/com/paiondata/astraios/SpringbootITSpec.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ public class SpringbootITSpec {
private static final String BOOK_PATH = "book/";
private static final String PRIDE_PREJUDICE = "Pride & Prejudice";
private static final String PRIDE_AND_PREJUDICE = "Pride and Prejudice";
private static final String CREATE_BOOK_JSON = "create-book.json";
private static final String UPDATE_BOOK_JSON = "update-book.json";
private static final String PAGE_SORT_JSON = "page-sort.json";
private static final String CREATE_BOOK_GRAPHQL = "create-book.graphql";
private static final String UPDATE_BOOK_GRAPHQL = "update-book.graphql";
private static final String PAGE_SORT_GRAPHQL = "page-sort.graphql";
private static final String BOOK_TITLE_01 = "Book Numero Dos";
private static final String BOOK_TITLE_02 = "Book Numero Tres";
private static final String BOOK_TITLE_04 = "Effective Java";
Expand Down Expand Up @@ -279,8 +279,8 @@ public void testGraphQLCrud() {
.given()
.contentType(MediaType.APPLICATION_JSON)
.accept(MediaType.APPLICATION_JSON)
.body(String.format(payload(UPDATE_BOOK_JSON),
BOOK_TITLE_02))
.body(toQueryString(String.format(payload(UPDATE_BOOK_GRAPHQL),
BOOK_TITLE_02)))
.when()
.post()
.then()
Expand Down Expand Up @@ -394,7 +394,7 @@ public void testGraphQLSortAndPaginate() {
.given()
.contentType(MediaType.APPLICATION_JSON)
.accept(MediaType.APPLICATION_JSON)
.body(payload(PAGE_SORT_JSON))
.body(toQueryString(payload(PAGE_SORT_GRAPHQL)))
.when()
.post();

Expand All @@ -419,15 +419,17 @@ private Response createBook(@NotNull final String title) {
.given()
.contentType(MediaType.APPLICATION_JSON)
.accept(MediaType.APPLICATION_JSON)
.body(String.format(payload(CREATE_BOOK_JSON),
title))
.body(toQueryString(String.format(payload(CREATE_BOOK_GRAPHQL),
title)))
.when()
.post();
}

/**
* Loads a resource file, under "payload" resource directory, as a {@code String} object given that resource file
* name.
* <p>
* All new line characters ("\n") will be removed as well.
*
* @param resourceName The specified resource file name
*
Expand Down
10 changes: 10 additions & 0 deletions src/test/resources/payload/create-book.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
mutation {
book(op: UPSERT, data: { title : "%s"}) {
edges {
node {
id
title
}
}
}
}
3 changes: 0 additions & 3 deletions src/test/resources/payload/create-book.json

This file was deleted.

16 changes: 16 additions & 0 deletions src/test/resources/payload/page-sort.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
book(sort: "-id", first: "1", after: "0") {
edges {
node {
id
title
}
}
pageInfo {
totalRecords
startCursor
endCursor
hasNextPage
}
}
}
3 changes: 0 additions & 3 deletions src/test/resources/payload/page-sort.json

This file was deleted.

10 changes: 10 additions & 0 deletions src/test/resources/payload/update-book.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
mutation {
book(op: UPSERT, data: {id : "1", title : "%s"}) {
edges {
node {
id
title
}
}
}
}
3 changes: 0 additions & 3 deletions src/test/resources/payload/update-book.json

This file was deleted.

0 comments on commit 75cd6d6

Please sign in to comment.