UNPKG

@kingstinct/react-native-healthkit

Version:
36 lines (29 loc) 1.29 kB
/** * Test case to verify that queryStatisticsForQuantity resolves when no data is present */ import { describe, expect, test } from 'bun:test' import type { QueryStatisticsResponse } from '../types/QuantityType' describe('queryStatisticsForQuantity', () => { test('should resolve with empty response when no data is present', async () => { // This test would normally require running on iOS simulator or device // For now, we're just testing the TypeScript interface const mockEmptyResponse: QueryStatisticsResponse = { sources: [], } // Verify that empty response is properly typed expect(mockEmptyResponse.averageQuantity).toBeUndefined() expect(mockEmptyResponse.sumQuantity).toBeUndefined() expect(mockEmptyResponse.startDate).toBeUndefined() expect(mockEmptyResponse.endDate).toBeUndefined() }) test('should handle date range with no data', async () => { // This is more of a documentation of the expected behavior // The query should resolve with an empty response object // when there's no data in the specified timeframe const expectedResult: QueryStatisticsResponse = { sources: [], // All properties should be undefined for empty result } expect(expectedResult).toBeDefined() }) })