1
0
mirror of https://github.com/tcgdex/cards-database.git synced 2025-04-22 10:52:10 +00:00

feat: Add bruno to tests the APIs (#468)

This commit is contained in:
Florian Bouillon 2024-01-03 23:42:56 +01:00 committed by GitHub
parent 8fd7afeb32
commit 8684fb14e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 179 additions and 0 deletions

33
.bruno/GraphQL API.bru Normal file
View File

@ -0,0 +1,33 @@
meta {
name: GraphQL API
type: graphql
seq: 2
}
post {
url: {{BASE_URL}}/v2/graphql
body: graphql
auth: none
}
body:graphql {
query Pouet {
cards {
id
localId
name
set {
id
name
serie {
id
name
}
}
}
}
}
assert {
res.status: eq 200
}

View File

@ -0,0 +1,15 @@
meta {
name: Validate that we can run OPTIONS
type: http
seq: 1
}
options {
url: {{BASE_URL}}/status
body: none
auth: none
}
assert {
res.status: eq 200
}

8
.bruno/bruno.json Normal file
View File

@ -0,0 +1,8 @@
{
"version": "1",
"name": "TCGdex",
"type": "collection",
"presets": {
"requestType": "http"
}
}

View File

@ -0,0 +1,27 @@
meta {
name: get Card list
type: http
seq: 1
}
get {
url: {{BASE_URL}}/v2/en/cards?sort:field=name&sort:order=DESC&pagination:page=1&pagination:itemsPerPage=4
body: none
auth: none
}
query {
sort:field: name
sort:order: DESC
pagination:page: 1
pagination:itemsPerPage: 4
~name: furret
}
docs {
Fully describe the card list request, it also has every parameters it can
}
assert {
res.status: eq 200
}

View File

@ -0,0 +1,15 @@
meta {
name: get one card
type: http
seq: 2
}
get {
url: {{BASE_URL}}/v2/en/cards/swsh3-136
body: none
auth: none
}
assert {
res.status: eq 200
}

View File

@ -0,0 +1,3 @@
vars {
BASE_URL: http://localhost:3000
}

View File

@ -0,0 +1,3 @@
vars {
BASE_URL: https://api.tcgdex.net
}

View File

@ -0,0 +1,22 @@
meta {
name: invalid sorting
type: http
seq: 1
}
get {
url: {{BASE_URL}}/v2/en/sets/swsh8/53
body: none
auth: none
}
assert {
res.body.id: eq swsh8-53
res.status: eq 200
}
docs {
Validate the issue seen in
https://github.com/tcgdex/cards-database/issues/466
}

15
.bruno/sets/get a set.bru Normal file
View File

@ -0,0 +1,15 @@
meta {
name: get a set
type: http
seq: 2
}
get {
url: {{BASE_URL}}/v2/en/sets/swsh3
body: none
auth: none
}
assert {
res.status: eq 200
}

View File

@ -0,0 +1,23 @@
meta {
name: get list of sets
type: http
seq: 3
}
get {
url: {{BASE_URL}}/v2/en/sets?sort:field=name&sort:order=DESC&pagination:page=1&pagination:itemsPerPage=1&name=Dark
body: none
auth: none
}
query {
sort:field: name
sort:order: DESC
pagination:page: 1
pagination:itemsPerPage: 1
name: Dark
}
assert {
res.status: eq 200
}

View File

@ -0,0 +1,15 @@
meta {
name: get one card from a set
type: http
seq: 1
}
get {
url: {{BASE_URL}}/v2/en/cards/swsh3
body: none
auth: none
}
assert {
res.status: eq 200
}