Skip to content

Commit

Permalink
Merge pull request #479 from jellyfin/nvv-vitest
Browse files Browse the repository at this point in the history
  • Loading branch information
nielsvanvelzen committed Oct 3, 2023
2 parents ba67566 + 12371b4 commit c2ac063
Show file tree
Hide file tree
Showing 7 changed files with 2,360 additions and 5,203 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,5 @@ jobs:
- name: Install dependencies
run: npm ci --no-audit

- name: Build for production
run: npm run build

- name: Run tests
run: npm run test
7 changes: 0 additions & 7 deletions jest.config.js

This file was deleted.

7,533 changes: 2,350 additions & 5,183 deletions package-lock.json

Large diffs are not rendered by default.

9 changes: 3 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
},
"devDependencies": {
"@types/chromecast-caf-receiver": "6.0.10",
"@types/jest": "29.5.5",
"@typescript-eslint/eslint-plugin": "6.7.3",
"@typescript-eslint/parser": "6.7.3",
"eslint": "8.50.0",
Expand All @@ -22,14 +21,12 @@
"eslint-plugin-json": "3.1.0",
"eslint-plugin-prettier": "5.0.0",
"eslint-plugin-promise": "6.1.1",
"jest": "29.7.0",
"jest-environment-jsdom": "29.7.0",
"prettier": "3.0.3",
"stylelint": "15.10.3",
"stylelint-config-standard": "34.0.0",
"ts-jest": "29.1.1",
"typescript": "5.2.2",
"vite": "4.4.9"
"vite": "4.4.9",
"vitest": "0.34.6"
},
"homepage": "https://jellyfin.org/",
"license": "GPL-2.0-or-later",
Expand All @@ -40,7 +37,7 @@
"scripts": {
"start": "vite",
"build": "vite build",
"test": "jest --silent",
"test": "vitest",
"lint": "npm run lint:code && npm run lint:css && npm run prettier",
"lint:code": "eslint --ext .ts,.js,.json .",
"lint:css": "stylelint src/**/*.css",
Expand Down
2 changes: 2 additions & 0 deletions src/__tests__/credentialManager.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { describe, beforeEach, test, expect } from 'vitest';

import {
credentialManager,
ServerCredential
Expand Down
7 changes: 4 additions & 3 deletions src/components/__tests__/jellyfinApi.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { describe, beforeAll, beforeEach, test, expect } from 'vitest';
import { JellyfinApi } from '../jellyfinApi';
import { version } from '../../../package.json';

const setupMockCastSenders = (): void => {
const getSenders = (): Array<any> => [{ id: 'thisIsSenderId' }]; // eslint-disable-line @typescript-eslint/no-explicit-any
Expand Down Expand Up @@ -213,7 +215,7 @@ describe('getting security headers', () => {

// @ts-expect-error Since the method is private.
const result = JellyfinApi.getSecurityHeaders();
const correctAuth = `MediaBrowser Client="Chromecast", Token="thisIsAccessToken", Version="thisIsVersionNumber", DeviceId="${btoa(
const correctAuth = `MediaBrowser Client="Chromecast", Token="thisIsAccessToken", Version="${version}", DeviceId="${btoa(
'thisIsReceiverName'
)}", Device="thisIsReceiverName"`;

Expand All @@ -231,8 +233,7 @@ describe('getting security headers', () => {
// @ts-expect-error Since the method is private.
const result = JellyfinApi.getSecurityHeaders();
const correct = {
Authorization:
'MediaBrowser Client="Chromecast", Token="thisIsAccessToken", Version="thisIsVersionNumber", DeviceId="thisIsSenderId", Device="Google%20Cast"'
Authorization: `MediaBrowser Client="Chromecast", Token="thisIsAccessToken", Version="${version}", DeviceId="thisIsSenderId", Device="Google%20Cast"`
};

expect(result).toMatchObject(correct);
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@
"paths": {
"~/*": ["./*"]
},
"types": ["@types/chromecast-caf-receiver", "jest", "vite/client"]
"types": ["@types/chromecast-caf-receiver", "vite/client"]
}
}

0 comments on commit c2ac063

Please sign in to comment.