mirror of
https://github.com/kikootwo/ReadMeABook.git
synced 2026-06-03 12:50:09 +00:00
fb0445d95f
Introduce a centralized RMAB_USER_AGENT constant (ReadMeABook/<version>) and update audible service calls to use it instead of hardcoded values. This avoids the default axios UA (which some indexers reject) and replaces the previous `rmab/` identifier. Adds unit tests to verify the User-Agent format and ensure it doesn't resemble generic bot signatures.
14 lines
444 B
TypeScript
14 lines
444 B
TypeScript
import { describe, it, expect } from 'vitest';
|
|
import { RMAB_USER_AGENT } from '@/lib/utils/user-agent';
|
|
|
|
describe('RMAB_USER_AGENT', () => {
|
|
it('uses the ReadMeABook/<semver> format', () => {
|
|
expect(RMAB_USER_AGENT).toMatch(/^ReadMeABook\/\d+\.\d+\.\d+/);
|
|
});
|
|
|
|
it('does not look like a generic bot signature', () => {
|
|
expect(RMAB_USER_AGENT).not.toMatch(/^axios\//);
|
|
expect(RMAB_USER_AGENT).not.toMatch(/^rmab\//);
|
|
});
|
|
});
|