From 11ec2aa846758061f8d21388d065698109aab873 Mon Sep 17 00:00:00 2001 From: Willman Duffy Date: Sat, 30 Nov 2024 17:53:36 -0500 Subject: [PATCH] Add GitHub Actions for test suite --- .github/workflows/test.yml | 26 ++++++++++++++++++++++++++ package.json | 3 +++ src/services/sync.test.ts | 2 +- 3 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..df4fb3a --- /dev/null +++ b/.github/workflows/test.yml @@ -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 \ No newline at end of file diff --git a/package.json b/package.json index 2743134..7cca812 100644 --- a/package.json +++ b/package.json @@ -10,5 +10,8 @@ "dependencies": { "@atproto/api": "^0.13.18", "@imikailoby/lastfm-ts": "^2.0.1" + }, + "scripts": { + "test": "vitest run" } } diff --git a/src/services/sync.test.ts b/src/services/sync.test.ts index d217ff5..e18b12b 100644 --- a/src/services/sync.test.ts +++ b/src/services/sync.test.ts @@ -86,7 +86,7 @@ describe("sync", () => { url: "https://test.url", }; - vi.mocked(LastFM.prototype.getLatestSong).mockResolvedValue(mockTrack); + vi.mocked(LastFM.prototype.getLatestSon).mockResolvedValue(mockTrack); vi.mocked(BlueSky.retrieveAgent).mockRejectedValue( new Error("BlueSky error"), );