Skip to content

Commit

Permalink
adjusting tests to accept local images as valid
Browse files Browse the repository at this point in the history
  • Loading branch information
Luigy-Lemon committed Oct 2, 2023
1 parent 805ea55 commit 0cf58e2
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 15 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@1hive/default-token-list",
"version": "6.0.3",
"version": "6.1.3",
"description": "◦ The Honeyswap default token list",
"exports": "./build/index.json",
"type": "module",
Expand Down
30 changes: 16 additions & 14 deletions test/uniswap-default.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,30 +101,32 @@ describe("buildList", () => {
it("all images return status 200", async function () {
this.timeout(0);
const branch = getBranchFromArgs(undefined);
let fails = 0;
for (let token of defaultTokenList.tokens) {
let url = token.logoURI;
// if tokenURI have that format: *1Hive/default-token-list/master/src/assets/* then replace to *1Hive/default-token-list/{branch}/src/assets*
if (branch) {
if (url.includes("1Hive/default-token-list/master/src/assets/")) {
if (url.includes(`https://raw.githubusercontent.com/1Hive/default-token-list/master/src/assets/gnosis/${token.address.toLowerCase()}/logo.`)) {
if (branch) {

url = url.replace(
"1Hive/default-token-list/master/src/assets/",
`1Hive/default-token-list/${branch}/src/assets/`
);
}
}
let fails = 0;
try {
const response = await axios.get(url, { timeout: 20000 });
if (response.status === 200) {
// console.log(`URL ${url} é válida.`);
} else {
console.log(`URL ${url} retornou um status diferente de 200.`);
fails++;
}else{
try {
const response = await axios.get(url, { timeout: 20000 });
if (response.status === 200) {
// console.log(`URL ${url} é válida.`);
} else {
console.log(`URL ${url} retornou um status diferente de 200.`);
fails++;

}
} catch (error) {
fails++;
console.error(`Erro ao verificar a URL ${url}: ${error.message}`);
}
} catch (error) {
fails++;
console.error(`Erro ao verificar a URL ${url}: ${error.message}`);
}
expect(fails).to.eq(0);
}
Expand Down

0 comments on commit 0cf58e2

Please sign in to comment.