mirror of
https://github.com/jellyfin/jellyfin-sdk-typescript.git
synced 2024-11-27 00:01:19 +00:00
Add authentication tests
This commit is contained in:
parent
527ec22fb8
commit
fc9fc0bc35
30
src/utils/__tests__/authentication.test.ts
Normal file
30
src/utils/__tests__/authentication.test.ts
Normal file
@ -0,0 +1,30 @@
|
||||
/**
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
import { getAuthorizationHeader } from '..';
|
||||
|
||||
describe('Authentication', () => {
|
||||
it('should return the correct header value without token', () => {
|
||||
const header = getAuthorizationHeader({
|
||||
Name: 'SDK Test',
|
||||
Version: '0.0.0'
|
||||
}, {
|
||||
Name: 'Test Device',
|
||||
Id: 'TESTID'
|
||||
});
|
||||
expect(header).toEqual('MediaBrowser Client="SDK Test", Device="Test Device", DeviceId="TESTID", Version="0.0.0", Token=""');
|
||||
});
|
||||
|
||||
it('should return the correct header value with token', () => {
|
||||
const header = getAuthorizationHeader({
|
||||
Name: 'SDK Test',
|
||||
Version: '0.0.0'
|
||||
}, {
|
||||
Name: 'Test Device',
|
||||
Id: 'TESTID'
|
||||
}, 'TESTTOKEN');
|
||||
expect(header).toEqual('MediaBrowser Client="SDK Test", Device="Test Device", DeviceId="TESTID", Version="0.0.0", Token="TESTTOKEN"');
|
||||
});
|
||||
});
|
Loading…
Reference in New Issue
Block a user