Skip to content

Commit

Permalink
Install and configure jest for testing
Browse files Browse the repository at this point in the history
Ref #22
  • Loading branch information
thatbudakguy committed Aug 11, 2023
1 parent b6813e0 commit 42dc88f
Show file tree
Hide file tree
Showing 6 changed files with 3,405 additions and 121 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,6 @@ jobs:

- name: Lint typescript
run: yarn lint

- name: Run tests
run: yarn test
6 changes: 6 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
presets: [
['@babel/preset-env', { targets: { node: 'current' } }],
'@babel/preset-typescript',
],
};
8 changes: 7 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,17 @@
"build": "esbuild src/site.ts --outfile=public/index.min.js --bundle --minify --sourcemap",
"start": "esbuild src/site.ts --outfile=public/index.min.js --bundle --sourcemap --servedir=public",
"lint": "tsc --noEmit && prettier --check .",
"format": "prettier --write ."
"format": "prettier --write .",
"test": "jest"
},
"devDependencies": {
"@babel/preset-env": "^7.22.10",
"@babel/preset-typescript": "^7.22.5",
"@jest/globals": "^29.6.2",
"@types/turndown": "^5.0.1",
"esbuild": "^0.15.16",
"jest": "^29.6.2",
"jest-environment-jsdom": "^29.6.2",
"prettier": "^3.0.1",
"typescript": "^4.9.3"
}
Expand Down
2 changes: 1 addition & 1 deletion src/convert.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ export const convertCharacter = (
});

// Request the D&D Beyond avatar at a higher resolution in 1:1 aspect ratio
const convertAvatar = (ddbCharacter: DdbCharacter): string => {
export const convertAvatar = (ddbCharacter: DdbCharacter): string => {
if (!ddbCharacter.avatarUrl) return null;

let url = new URL(ddbCharacter.avatarUrl);
Expand Down
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"compilerOptions": {
"esModuleInterop": true,
"resolveJsonModule": true,
"lib": ["es2019", "dom"]
}
}
Loading

0 comments on commit 42dc88f

Please sign in to comment.