Skip to content

Commit

Permalink
Update tokens.spec.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
bilou42 authored Jan 1, 2025
1 parent f447922 commit 44507d5
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions tokens.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {Asset, Name} from '@wharfkit/antelope'
import {expect, test} from 'bun:test'
import fs from "fs";

// Token-specific values
const BASE_URL = 'https://raw.githubusercontent.com/eoscafe/eos-airdrops/master/logos/';
const CHAINS = ["eos", "telos", "wax", "proton"];

Expand All @@ -28,6 +29,7 @@ test('must be valid chain', async () => {

test('missing logo file', async () => {
for ( const token of tokens ) {
// Check if the logo files exist locally
expect(fs.existsSync(`./logos/${token.logo.replace(BASE_URL, '')}`)).toBe(true)
expect(fs.existsSync(`./logos/${token.logo_lg.replace(BASE_URL, '')}`)).toBe(true)
}
Expand All @@ -42,12 +44,12 @@ test('logo file not associated with a token', async () => {

const files = fs.readdirSync('./logos');
for ( const file of files ) {
if ( file === ".DS_Store" ) continue;
if ( file === ".DS_Store" ) continue; // Skip system-specific files
if ( !logos.has(file) ) {
console.log("removed file:", file)
fs.rmSync(`./logos/${file}`)
}
expect(logos.has(file)).toBe(true)
expect(logos.has(file)).toBe(true) // Ensure logos are properly linked

Check failure on line 52 in tokens.spec.ts

View workflow job for this annotation

GitHub Actions / build-and-test

error: expect(received).toBe(expected)

Expected: true Received: false at /home/runner/work/eos-airdrops/eos-airdrops/tokens.spec.ts:52:33 at /home/runner/work/eos-airdrops/eos-airdrops/tokens.spec.ts:38:47
}
})

Expand All @@ -70,6 +72,7 @@ test('token name must be sorted alphabetically', async () => {
last = token.name
continue
}
// Ensure that token names are sorted alphabetically
expect(token.name[0].toLocaleLowerCase() >= last[0].toLocaleLowerCase()).toBe(true)
last = token.name
}
Expand All @@ -79,7 +82,8 @@ test('no duplicate tokens', async () => {
let last = '';
for ( const token of tokens ) {
const token_key = `${token.chain},${token.symbol},${token.account}`;
if ( last == token_key ) console.log(last, token_key)
// Ensure there are no duplicate tokens based on chain, symbol, and account
if ( last === token_key ) console.log(last, token_key)
expect(last != token_key).toBe(true)
last = token_key
}
Expand Down

0 comments on commit 44507d5

Please sign in to comment.