feat: переработать кастомизацию HttpClient
- добавлен плоский ApiConfig с lifecycle hooks - добавлены ApiError, retry context, timeout и кастомные parser/serializer - обновлены примеры, документация и тесты под новый API
This commit is contained in:
@@ -251,7 +251,7 @@ describe('Generator', () => {
|
||||
expect(content).toContain('guest');
|
||||
}, 30000);
|
||||
|
||||
test('должен обработать Bearer authentication', async () => {
|
||||
test('должен генерировать hooks для авторизации', async () => {
|
||||
const outputPath = join(tempDir, 'output');
|
||||
const config: GeneratorConfig = {
|
||||
inputPath: FIXTURES.WITH_AUTH,
|
||||
@@ -265,8 +265,11 @@ describe('Generator', () => {
|
||||
const generatedFile = join(outputPath, 'http-client.ts');
|
||||
const content = await readTextFile(generatedFile);
|
||||
|
||||
// Проверяем наличие методов для работы с токеном
|
||||
expect(content).toContain('setSecurityData');
|
||||
// Проверяем наличие hooks для добавления авторизации
|
||||
expect(content).toContain('onRequest?: RequestInterceptor');
|
||||
expect(content).toContain('secure?: boolean');
|
||||
expect(content).not.toContain('baseApiParams');
|
||||
expect(content).not.toContain('setSecurityData');
|
||||
}, 30000);
|
||||
|
||||
test('должен использовать baseUrl из servers', async () => {
|
||||
|
||||
Reference in New Issue
Block a user