UNPKG

@chez14/mal-api-lite

Version:
36 lines (30 loc) 1.02 kB
import { describe, expect, it } from 'vitest'; import { MALClient } from './client.js'; describe('Client Instantiation', () => { it('Throw error when client id is provided but not client secret', () => { expect(() => (new MALClient({ 'clientId': 'client-id' }))).toThrowError(); }); it('Throw error when client secret is provided but not client id', () => { expect(() => (new MALClient({ 'clientSecret': 'client-secret' }))).toThrowError(); }); it('Accepts when provided with both creds', () => { expect(() => (new MALClient({ 'clientId': 'client-id', 'clientSecret': 'client-secret' }))).not.toThrowError(); }); it('Accepts when only access token is provided', () => { expect(() => (new MALClient({ 'accessToken': 'access-token' }))).not.toThrowError(); }); it('Throw error when only refresh token is provided', () => { expect(() => (new MALClient({ 'refreshToken': 'refresh-token' }))).not.toThrowError(); }); });