Skip to content

Commit

Permalink
Remove unused createUserUrl function
Browse files Browse the repository at this point in the history
  • Loading branch information
3flex committed Nov 10, 2024
1 parent 2e0199a commit 4aae3d2
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 51 deletions.
37 changes: 0 additions & 37 deletions src/components/__tests__/jellyfinApi.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,43 +52,6 @@ describe('creating basic urls', () => {
});
});

describe('creating user urls', () => {
beforeAll(() => {
setupMockCastSenders();
});

beforeEach(() => {
JellyfinApi.setServerInfo(
'thisIsUserId',
'thisIsAccessToken',
'thisIsServerAddress'
);
});

test('should return correct url', () => {
const result = JellyfinApi.createUserUrl('somePath');
const correct = 'thisIsServerAddress/Users/thisIsUserId/somePath';

expect(result).toEqual(correct);
});

test('should remove leading slashes', () => {
const result = JellyfinApi.createUserUrl('////////somePath');
const correct = 'thisIsServerAddress/Users/thisIsUserId/somePath';

expect(result).toEqual(correct);
});

test('should return empty string on undefined serverAddress', () => {
JellyfinApi.setServerInfo();

const result = JellyfinApi.createUserUrl('somePath');
const correct = '';

expect(result).toEqual(correct);
});
});

describe('creating image urls', () => {
beforeAll(() => {
setupMockCastSenders();
Expand Down
14 changes: 0 additions & 14 deletions src/components/jellyfinApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,20 +125,6 @@ export abstract class JellyfinApi {
return `${this.serverAddress}/${path}`;
}

// create a path in /Users/userId/ <path>
public static createUserUrl(path: string | null = null): string {
if (path) {
// Remove leading slashes
while (path.startsWith('/')) {
path = path.substring(1);
}

return this.createUrl(`Users/${this.userId}/${path}`);
} else {
return this.createUrl(`Users/${this.userId}`);
}
}

/**
* Create url to image
* @param itemId - Item id
Expand Down

0 comments on commit 4aae3d2

Please sign in to comment.