Skip to content

Commit

Permalink
feat: Add bruno to tests the APIs (#468)
Browse files Browse the repository at this point in the history
  • Loading branch information
Aviortheking authored Jan 3, 2024
1 parent 8fd7afe commit 8684fb1
Show file tree
Hide file tree
Showing 11 changed files with 179 additions and 0 deletions.
33 changes: 33 additions & 0 deletions .bruno/GraphQL API.bru
Original file line number Diff line number Diff line change
@@ -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
}
15 changes: 15 additions & 0 deletions .bruno/Validate that we can run OPTIONS.bru
Original file line number Diff line number Diff line change
@@ -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 changes: 8 additions & 0 deletions .bruno/bruno.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"version": "1",
"name": "TCGdex",
"type": "collection",
"presets": {
"requestType": "http"
}
}
27 changes: 27 additions & 0 deletions .bruno/cards/get Card list.bru
Original file line number Diff line number Diff line change
@@ -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
}
15 changes: 15 additions & 0 deletions .bruno/cards/get one card.bru
Original file line number Diff line number Diff line change
@@ -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
}
3 changes: 3 additions & 0 deletions .bruno/environments/Developpement.bru
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
vars {
BASE_URL: http://localhost:3000
}
3 changes: 3 additions & 0 deletions .bruno/environments/Production.bru
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
vars {
BASE_URL: https://api.tcgdex.net
}
22 changes: 22 additions & 0 deletions .bruno/fixes/invalid sorting.bru
Original file line number Diff line number Diff line change
@@ -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 changes: 15 additions & 0 deletions .bruno/sets/get a set.bru
Original file line number Diff line number Diff line change
@@ -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
}
23 changes: 23 additions & 0 deletions .bruno/sets/get list of sets.bru
Original file line number Diff line number Diff line change
@@ -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
}
15 changes: 15 additions & 0 deletions .bruno/sets/get one card from a set.bru
Original file line number Diff line number Diff line change
@@ -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
}

0 comments on commit 8684fb1

Please sign in to comment.