23 lines
862 B
TypeScript
23 lines
862 B
TypeScript
import { describe, it, expect } from 'vitest';
|
|
import { WhiskClient } from './whisk-client';
|
|
|
|
describe('WhiskClient', () => {
|
|
it('should throw error if no cookies provided', () => {
|
|
expect(() => new WhiskClient('')).toThrow('No valid cookies provided');
|
|
});
|
|
|
|
it('should parse cookie string correctly', () => {
|
|
const client = new WhiskClient('foo=bar; baz=qux');
|
|
// Accessing private property for testing via casting or just trusting constructor didn't fail
|
|
expect(client).toBeDefined();
|
|
});
|
|
|
|
it('should parse JSON cookies correctly', () => {
|
|
const jsonCookies = JSON.stringify([
|
|
{ name: 'foo', value: 'bar' },
|
|
{ name: 'baz', value: 'qux' }
|
|
]);
|
|
const client = new WhiskClient(jsonCookies);
|
|
expect(client).toBeDefined();
|
|
});
|
|
});
|