/
githubmirror
/
novu
Обзор
Документация
Войти
/
githubmirror
/
novu
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
next
packages/shared/src/utils/checkIsResponseError.spec.ts
61 строка
2 KB
Adam Chmara
chore(root): apply biome formatter & linter fixes NV-6436 (#8838)
31 июл 2025, 14:59
Не верифицирован
31 июл 2025, 14:59
855fb8f
Код
Авторство
О чём код?
import { describe, expect, it } from 'vitest'; import { IResponseError } from '../types'; import { checkIsResponseError } from './checkIsResponseError'; describe('checkIsResponseError', () => { it('should return true for a valid IResponseError object', () => { const error: IResponseError = { error: 'Something went wrong', message: 'An error occurred', statusCode: 500, }; const result = checkIsResponseError(error); expect(result).toBe(true); }); it('should return false for null', () => { const result = checkIsResponseError(null); expect(result).toBe(false); }); it('should return false for undefined', () => { const result = checkIsResponseError(undefined); expect(result).toBe(false); }); it('should return false for a non-object value', () => { const result = checkIsResponseError('This is a string'); expect(result).toBe(false); }); it('should return false if the object is missing the "error" property', () => { const error = { message: 'An error occurred', statusCode: 500, }; const result = checkIsResponseError(error); expect(result).toBe(false); }); it('should return false if the object is missing the "message" property', () => { const error = { error: 'Something went wrong', statusCode: 500, }; const result = checkIsResponseError(error); expect(result).toBe(false); }); it('should return false if the object is missing the "statusCode" property', () => { const error = { error: 'Something went wrong', message: 'An error occurred', }; const result = checkIsResponseError(error); expect(result).toBe(false); }); });