Skip to content

Commit

Permalink
Add GitHub Actions for test suite
Browse files Browse the repository at this point in the history
  • Loading branch information
willmanduffy committed Nov 30, 2024
1 parent 7ac6247 commit 11ec2aa
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 1 deletion.
26 changes: 26 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Tests

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Run tests
run: npm test
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,8 @@
"dependencies": {
"@atproto/api": "^0.13.18",
"@imikailoby/lastfm-ts": "^2.0.1"
},
"scripts": {
"test": "vitest run"
}
}
2 changes: 1 addition & 1 deletion src/services/sync.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ describe("sync", () => {
url: "https://test.url",
};

vi.mocked(LastFM.prototype.getLatestSong).mockResolvedValue(mockTrack);
vi.mocked(LastFM.prototype.getLatestSon).mockResolvedValue(mockTrack);

Check failure on line 89 in src/services/sync.test.ts

View workflow job for this annotation

GitHub Actions / test

src/services/sync.test.ts > sync > should handle BlueSky errors

TypeError: Cannot read properties of undefined (reading 'mockResolvedValue') ❯ src/services/sync.test.ts:89:44
vi.mocked(BlueSky.retrieveAgent).mockRejectedValue(
new Error("BlueSky error"),
);
Expand Down

0 comments on commit 11ec2aa

Please sign in to comment.