wip
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
import { AnalyticsSessionId } from '../../../../../packages/analytics/domain/value-objects/AnalyticsSessionId';
|
||||
|
||||
describe('AnalyticsSessionId', () => {
|
||||
it('creates a valid AnalyticsSessionId from a non-empty string', () => {
|
||||
const id = AnalyticsSessionId.create('session_123');
|
||||
|
||||
expect(id.value).toBe('session_123');
|
||||
});
|
||||
|
||||
it('trims whitespace from the raw value', () => {
|
||||
const id = AnalyticsSessionId.create(' session_456 ');
|
||||
|
||||
expect(id.value).toBe('session_456');
|
||||
});
|
||||
|
||||
it('throws for empty or whitespace-only strings', () => {
|
||||
expect(() => AnalyticsSessionId.create('')).toThrow(Error);
|
||||
expect(() => AnalyticsSessionId.create(' ')).toThrow(Error);
|
||||
});
|
||||
|
||||
it('compares equality based on underlying value', () => {
|
||||
const a = AnalyticsSessionId.create('session_1');
|
||||
const b = AnalyticsSessionId.create('session_1');
|
||||
const c = AnalyticsSessionId.create('session_2');
|
||||
|
||||
expect(a.equals(b)).toBe(true);
|
||||
expect(a.equals(c)).toBe(false);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user