-
-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from saleem-hadad/feature/ui-unit-testing
✍️ Add UI unit tests #feature
- Loading branch information
Showing
60 changed files
with
1,312 additions
and
417 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
{ | ||
"presets": ["@babel/preset-env", "@babel/preset-react"] | ||
"presets": ["@babel/preset-env", "@babel/preset-react"], | ||
"plugins": [ | ||
["@babel/transform-runtime"] | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,3 +13,4 @@ npm-debug.log | |
yarn-error.log | ||
/.idea | ||
/.vscode | ||
coverage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{ | ||
"/js/app.js": "/js/app.js?id=d80c6aa68ccfd74342c8", | ||
"/css/app.css": "/css/app.css?id=9980ba94755724b3d676" | ||
"/js/app.js": "/js/app.js?id=646cbe42f9883c5bee75", | ||
"/css/app.css": "/css/app.css?id=302229d53296b2231e13" | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
import { gql } from '@urql/core'; | ||
import client from './client.js'; | ||
|
||
export const getAllBrands = () => { | ||
return client | ||
.query(gql` | ||
query { | ||
allBrands { | ||
id | ||
name | ||
category { | ||
name | ||
} | ||
} | ||
} | ||
`) | ||
.toPromise(); | ||
} | ||
|
||
export const getBrands = (page) => { | ||
return client | ||
.query(gql` | ||
query { | ||
brands(page: ${page}) { | ||
data { | ||
id | ||
name | ||
category { | ||
id | ||
name | ||
} | ||
} | ||
paginatorInfo { | ||
hasMorePages | ||
} | ||
} | ||
} | ||
`) | ||
.toPromise(); | ||
} | ||
|
||
export const createBrand = ({name, categoryId}) => { | ||
return client | ||
.mutation(gql` | ||
mutation { | ||
createBrand(name: """${name}""" category_id: ${categoryId}) { | ||
id | ||
name | ||
category { | ||
id | ||
name | ||
} | ||
} | ||
} | ||
`) | ||
.toPromise(); | ||
} | ||
|
||
export const updateBrand = ({id, name, category}) => { | ||
return client | ||
.mutation(gql` | ||
mutation { | ||
updateBrand(id: ${id} name: "${name}" category_id: ${category}) { | ||
id | ||
name | ||
category { | ||
id | ||
name | ||
} | ||
} | ||
} | ||
`) | ||
.toPromise(); | ||
} |
Oops, something went wrong.