Launch
This commit is contained in:
@@ -1,29 +1,29 @@
|
||||
import { getConfiguredApiBaseUrl, getConfiguredAssetBaseUrl } from '../../utils/backendUrl';
|
||||
|
||||
describe('backendUrl utilities', () => {
|
||||
const originalApiUrl = process.env.EXPO_PUBLIC_API_URL;
|
||||
const originalBackendUrl = process.env.EXPO_PUBLIC_BACKEND_URL;
|
||||
const originalPaymentServerUrl = process.env.EXPO_PUBLIC_PAYMENT_SERVER_URL;
|
||||
|
||||
afterEach(() => {
|
||||
process.env.EXPO_PUBLIC_API_URL = originalApiUrl;
|
||||
process.env.EXPO_PUBLIC_BACKEND_URL = originalBackendUrl;
|
||||
process.env.EXPO_PUBLIC_PAYMENT_SERVER_URL = originalPaymentServerUrl;
|
||||
});
|
||||
|
||||
it('prefers EXPO_PUBLIC_API_URL when present', () => {
|
||||
process.env.EXPO_PUBLIC_API_URL = 'https://api.example.com/api';
|
||||
process.env.EXPO_PUBLIC_BACKEND_URL = 'https://backend.example.com';
|
||||
|
||||
expect(getConfiguredApiBaseUrl()).toBe('https://api.example.com/api');
|
||||
expect(getConfiguredAssetBaseUrl()).toBe('https://api.example.com');
|
||||
});
|
||||
|
||||
it('falls back to EXPO_PUBLIC_BACKEND_URL and appends /api', () => {
|
||||
delete process.env.EXPO_PUBLIC_API_URL;
|
||||
process.env.EXPO_PUBLIC_BACKEND_URL = 'https://backend.example.com';
|
||||
|
||||
expect(getConfiguredApiBaseUrl()).toBe('https://backend.example.com/api');
|
||||
expect(getConfiguredAssetBaseUrl()).toBe('https://backend.example.com');
|
||||
});
|
||||
});
|
||||
import { getConfiguredApiBaseUrl, getConfiguredAssetBaseUrl } from '../../utils/backendUrl';
|
||||
|
||||
describe('backendUrl utilities', () => {
|
||||
const originalApiUrl = process.env.EXPO_PUBLIC_API_URL;
|
||||
const originalBackendUrl = process.env.EXPO_PUBLIC_BACKEND_URL;
|
||||
const originalPaymentServerUrl = process.env.EXPO_PUBLIC_PAYMENT_SERVER_URL;
|
||||
|
||||
afterEach(() => {
|
||||
process.env.EXPO_PUBLIC_API_URL = originalApiUrl;
|
||||
process.env.EXPO_PUBLIC_BACKEND_URL = originalBackendUrl;
|
||||
process.env.EXPO_PUBLIC_PAYMENT_SERVER_URL = originalPaymentServerUrl;
|
||||
});
|
||||
|
||||
it('prefers EXPO_PUBLIC_API_URL when present', () => {
|
||||
process.env.EXPO_PUBLIC_API_URL = 'https://api.example.com/api';
|
||||
process.env.EXPO_PUBLIC_BACKEND_URL = 'https://backend.example.com';
|
||||
|
||||
expect(getConfiguredApiBaseUrl()).toBe('https://api.example.com/api');
|
||||
expect(getConfiguredAssetBaseUrl()).toBe('https://api.example.com');
|
||||
});
|
||||
|
||||
it('falls back to EXPO_PUBLIC_BACKEND_URL and appends /api', () => {
|
||||
delete process.env.EXPO_PUBLIC_API_URL;
|
||||
process.env.EXPO_PUBLIC_BACKEND_URL = 'https://backend.example.com';
|
||||
|
||||
expect(getConfiguredApiBaseUrl()).toBe('https://backend.example.com/api');
|
||||
expect(getConfiguredAssetBaseUrl()).toBe('https://backend.example.com');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,71 +1,71 @@
|
||||
import { rankHybridEntries, scoreHybridEntry } from '../../utils/hybridSearch';
|
||||
|
||||
describe('hybridSearch', () => {
|
||||
const entries = [
|
||||
{
|
||||
name: 'Snake Plant',
|
||||
botanicalName: 'Sansevieria trifasciata',
|
||||
description: 'Very resilient houseplant that handles little light well.',
|
||||
categories: ['easy', 'low_light', 'air_purifier'],
|
||||
careInfo: { waterIntervalDays: 14, light: 'Low to full light', temp: '16-30C' },
|
||||
},
|
||||
{
|
||||
name: 'Spider Plant',
|
||||
botanicalName: 'Chlorophytum comosum',
|
||||
description: 'Easy houseplant that is safe for pets and helps clean indoor air.',
|
||||
categories: ['easy', 'pet_friendly', 'air_purifier'],
|
||||
careInfo: { waterIntervalDays: 6, light: 'Bright to partial shade', temp: '16-24C' },
|
||||
},
|
||||
{
|
||||
name: 'Anthurium',
|
||||
botanicalName: 'Anthurium andraeanum',
|
||||
description: 'Flowering tropical plant for bright indirect light.',
|
||||
categories: ['flowering'],
|
||||
careInfo: { waterIntervalDays: 6, light: 'Bright indirect light', temp: '18-27C' },
|
||||
},
|
||||
{
|
||||
name: 'Boston Fern',
|
||||
botanicalName: 'Nephrolepis exaltata',
|
||||
description: 'Loves steady moisture and humid rooms.',
|
||||
categories: ['high_humidity', 'hanging'],
|
||||
careInfo: { waterIntervalDays: 3, light: 'Partial shade', temp: '16-24C' },
|
||||
},
|
||||
{
|
||||
name: 'Aloe Vera',
|
||||
botanicalName: 'Aloe vera',
|
||||
description: 'Sun-loving succulent for bright windows.',
|
||||
categories: ['succulent', 'sun', 'medicinal'],
|
||||
careInfo: { waterIntervalDays: 12, light: 'Sunny', temp: '18-30C' },
|
||||
},
|
||||
];
|
||||
|
||||
it('ranks multi-intent matches above single-attribute matches', () => {
|
||||
const results = rankHybridEntries(entries, 'pet friendly air purifier', 3);
|
||||
expect(results[0].entry.name).toBe('Spider Plant');
|
||||
});
|
||||
|
||||
it('understands natural low-light and easy-care intent', () => {
|
||||
const results = rankHybridEntries(entries, 'easy plant for dark corner', 3);
|
||||
expect(results[0].entry.name).toBe('Snake Plant');
|
||||
});
|
||||
|
||||
it('keeps exact-name matches ahead of semantic-only matches', () => {
|
||||
const scores = entries.map((entry) => ({
|
||||
name: entry.name,
|
||||
score: scoreHybridEntry(entry, 'snake plant'),
|
||||
}));
|
||||
const snakeScore = scores.find((entry) => entry.name === 'Snake Plant')?.score || 0;
|
||||
const spiderScore = scores.find((entry) => entry.name === 'Spider Plant')?.score || 0;
|
||||
expect(snakeScore).toBeGreaterThan(spiderScore);
|
||||
});
|
||||
|
||||
it('maps bathroom-style queries to high-humidity plants', () => {
|
||||
const results = rankHybridEntries(entries, 'bathroom plant', 3);
|
||||
expect(results[0].entry.name).toBe('Boston Fern');
|
||||
});
|
||||
|
||||
it('maps sunny-window queries to sun-loving plants', () => {
|
||||
const results = rankHybridEntries(entries, 'plant for sunny window', 3);
|
||||
expect(results[0].entry.name).toBe('Aloe Vera');
|
||||
});
|
||||
});
|
||||
import { rankHybridEntries, scoreHybridEntry } from '../../utils/hybridSearch';
|
||||
|
||||
describe('hybridSearch', () => {
|
||||
const entries = [
|
||||
{
|
||||
name: 'Snake Plant',
|
||||
botanicalName: 'Sansevieria trifasciata',
|
||||
description: 'Very resilient houseplant that handles little light well.',
|
||||
categories: ['easy', 'low_light', 'air_purifier'],
|
||||
careInfo: { waterIntervalDays: 14, light: 'Low to full light', temp: '16-30C' },
|
||||
},
|
||||
{
|
||||
name: 'Spider Plant',
|
||||
botanicalName: 'Chlorophytum comosum',
|
||||
description: 'Easy houseplant that is safe for pets and helps clean indoor air.',
|
||||
categories: ['easy', 'pet_friendly', 'air_purifier'],
|
||||
careInfo: { waterIntervalDays: 6, light: 'Bright to partial shade', temp: '16-24C' },
|
||||
},
|
||||
{
|
||||
name: 'Anthurium',
|
||||
botanicalName: 'Anthurium andraeanum',
|
||||
description: 'Flowering tropical plant for bright indirect light.',
|
||||
categories: ['flowering'],
|
||||
careInfo: { waterIntervalDays: 6, light: 'Bright indirect light', temp: '18-27C' },
|
||||
},
|
||||
{
|
||||
name: 'Boston Fern',
|
||||
botanicalName: 'Nephrolepis exaltata',
|
||||
description: 'Loves steady moisture and humid rooms.',
|
||||
categories: ['high_humidity', 'hanging'],
|
||||
careInfo: { waterIntervalDays: 3, light: 'Partial shade', temp: '16-24C' },
|
||||
},
|
||||
{
|
||||
name: 'Aloe Vera',
|
||||
botanicalName: 'Aloe vera',
|
||||
description: 'Sun-loving succulent for bright windows.',
|
||||
categories: ['succulent', 'sun', 'medicinal'],
|
||||
careInfo: { waterIntervalDays: 12, light: 'Sunny', temp: '18-30C' },
|
||||
},
|
||||
];
|
||||
|
||||
it('ranks multi-intent matches above single-attribute matches', () => {
|
||||
const results = rankHybridEntries(entries, 'pet friendly air purifier', 3);
|
||||
expect(results[0].entry.name).toBe('Spider Plant');
|
||||
});
|
||||
|
||||
it('understands natural low-light and easy-care intent', () => {
|
||||
const results = rankHybridEntries(entries, 'easy plant for dark corner', 3);
|
||||
expect(results[0].entry.name).toBe('Snake Plant');
|
||||
});
|
||||
|
||||
it('keeps exact-name matches ahead of semantic-only matches', () => {
|
||||
const scores = entries.map((entry) => ({
|
||||
name: entry.name,
|
||||
score: scoreHybridEntry(entry, 'snake plant'),
|
||||
}));
|
||||
const snakeScore = scores.find((entry) => entry.name === 'Snake Plant')?.score || 0;
|
||||
const spiderScore = scores.find((entry) => entry.name === 'Spider Plant')?.score || 0;
|
||||
expect(snakeScore).toBeGreaterThan(spiderScore);
|
||||
});
|
||||
|
||||
it('maps bathroom-style queries to high-humidity plants', () => {
|
||||
const results = rankHybridEntries(entries, 'bathroom plant', 3);
|
||||
expect(results[0].entry.name).toBe('Boston Fern');
|
||||
});
|
||||
|
||||
it('maps sunny-window queries to sun-loving plants', () => {
|
||||
const results = rankHybridEntries(entries, 'plant for sunny window', 3);
|
||||
expect(results[0].entry.name).toBe('Aloe Vera');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,37 +1,37 @@
|
||||
import { getPlantImageSourceFallbackUri, tryResolveImageUri } from '../../utils/imageUri';
|
||||
|
||||
describe('imageUri utilities', () => {
|
||||
const originalApiUrl = process.env.EXPO_PUBLIC_API_URL;
|
||||
const originalBackendUrl = process.env.EXPO_PUBLIC_BACKEND_URL;
|
||||
|
||||
beforeEach(() => {
|
||||
process.env.EXPO_PUBLIC_API_URL = 'http://localhost:3000/api';
|
||||
delete process.env.EXPO_PUBLIC_BACKEND_URL;
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
process.env.EXPO_PUBLIC_API_URL = originalApiUrl;
|
||||
process.env.EXPO_PUBLIC_BACKEND_URL = originalBackendUrl;
|
||||
});
|
||||
|
||||
it('resolves local plant asset paths against the API host', () => {
|
||||
expect(tryResolveImageUri('/plants/monstera.webp')).toBe('http://localhost:3000/plants/monstera.webp');
|
||||
expect(tryResolveImageUri('plants/aloe-vera-thumb.webp')).toBe('http://localhost:3000/plants/aloe-vera-thumb.webp');
|
||||
});
|
||||
|
||||
it('rejects invalid local paths outside the plants directory', () => {
|
||||
expect(tryResolveImageUri('/uploads/monstera.webp')).toBeNull();
|
||||
expect(tryResolveImageUri('../plants/monstera.webp')).toBeNull();
|
||||
});
|
||||
|
||||
it('resolves local plant asset paths against EXPO_PUBLIC_BACKEND_URL when API_URL is absent', () => {
|
||||
delete process.env.EXPO_PUBLIC_API_URL;
|
||||
process.env.EXPO_PUBLIC_BACKEND_URL = 'https://backend.example.com';
|
||||
|
||||
expect(tryResolveImageUri('/plants/rose.webp')).toBe('https://backend.example.com/plants/rose.webp');
|
||||
});
|
||||
|
||||
it('falls back from a missing local asset to the manifest-backed source image', () => {
|
||||
expect(getPlantImageSourceFallbackUri('/plants/rosa-x-hybrida--rose--7375780c.webp')).toMatch(/^https?:\/\//);
|
||||
});
|
||||
});
|
||||
import { getPlantImageSourceFallbackUri, tryResolveImageUri } from '../../utils/imageUri';
|
||||
|
||||
describe('imageUri utilities', () => {
|
||||
const originalApiUrl = process.env.EXPO_PUBLIC_API_URL;
|
||||
const originalBackendUrl = process.env.EXPO_PUBLIC_BACKEND_URL;
|
||||
|
||||
beforeEach(() => {
|
||||
process.env.EXPO_PUBLIC_API_URL = 'http://localhost:3000/api';
|
||||
delete process.env.EXPO_PUBLIC_BACKEND_URL;
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
process.env.EXPO_PUBLIC_API_URL = originalApiUrl;
|
||||
process.env.EXPO_PUBLIC_BACKEND_URL = originalBackendUrl;
|
||||
});
|
||||
|
||||
it('resolves local plant asset paths against the API host', () => {
|
||||
expect(tryResolveImageUri('/plants/monstera.webp')).toBe('http://localhost:3000/plants/monstera.webp');
|
||||
expect(tryResolveImageUri('plants/aloe-vera-thumb.webp')).toBe('http://localhost:3000/plants/aloe-vera-thumb.webp');
|
||||
});
|
||||
|
||||
it('rejects invalid local paths outside the plants directory', () => {
|
||||
expect(tryResolveImageUri('/uploads/monstera.webp')).toBeNull();
|
||||
expect(tryResolveImageUri('../plants/monstera.webp')).toBeNull();
|
||||
});
|
||||
|
||||
it('resolves local plant asset paths against EXPO_PUBLIC_BACKEND_URL when API_URL is absent', () => {
|
||||
delete process.env.EXPO_PUBLIC_API_URL;
|
||||
process.env.EXPO_PUBLIC_BACKEND_URL = 'https://backend.example.com';
|
||||
|
||||
expect(tryResolveImageUri('/plants/rose.webp')).toBe('https://backend.example.com/plants/rose.webp');
|
||||
});
|
||||
|
||||
it('falls back from a missing local asset to the manifest-backed source image', () => {
|
||||
expect(getPlantImageSourceFallbackUri('/plants/rosa-x-hybrida--rose--7375780c.webp')).toMatch(/^https?:\/\//);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,42 +1,42 @@
|
||||
import { rankHybridEntries } from '../../utils/hybridSearch';
|
||||
|
||||
describe('semantic category matrix', () => {
|
||||
const entries = [
|
||||
{ name: 'Starter Plant', botanicalName: 'Starter easya', description: 'Hard to kill starter plant.', categories: ['easy'], careInfo: { waterIntervalDays: 7, light: 'Bright indirect light', temp: '18-24C' } },
|
||||
{ name: 'Office Shade Plant', botanicalName: 'Shadea officis', description: 'Handles office corners well.', categories: ['low_light'], careInfo: { waterIntervalDays: 8, light: 'Low light', temp: '18-24C' } },
|
||||
{ name: 'Bright Window Plant', botanicalName: 'Brighta windowii', description: 'Thrives in bright rooms.', categories: ['bright_light'], careInfo: { waterIntervalDays: 7, light: 'Bright indirect light', temp: '18-24C' } },
|
||||
{ name: 'Sunny Aloe', botanicalName: 'Aloe vera', description: 'Sun-loving succulent for a south-facing window.', categories: ['sun'], careInfo: { waterIntervalDays: 12, light: 'Sunny', temp: '18-30C' } },
|
||||
{ name: 'Safe Pilea', botanicalName: 'Pilea peperomioides', description: 'Non toxic and pet friendly.', categories: ['pet_friendly'], careInfo: { waterIntervalDays: 7, light: 'Bright indirect light', temp: '18-24C' } },
|
||||
{ name: 'Air Cleaner Plant', botanicalName: 'Chlorophytum comosum', description: 'Helps clean the air indoors.', categories: ['air_purifier'], careInfo: { waterIntervalDays: 6, light: 'Bright to partial shade', temp: '16-24C' } },
|
||||
{ name: 'Bathroom Fern', botanicalName: 'Nephrolepis exaltata', description: 'Loves humidity and steady moisture.', categories: ['high_humidity'], careInfo: { waterIntervalDays: 3, light: 'Partial shade', temp: '16-24C' } },
|
||||
{ name: 'Trailing Vine', botanicalName: 'Epipremnum aureum', description: 'Fast-growing trailing shelf plant.', categories: ['hanging'], careInfo: { waterIntervalDays: 7, light: 'Partial shade to bright', temp: '18-27C' } },
|
||||
{ name: 'Striped Leaf Plant', botanicalName: 'Calathea ornata', description: 'Decorative leaves with striped patterns.', categories: ['patterned'], careInfo: { waterIntervalDays: 5, light: 'Partial shade', temp: '18-25C' } },
|
||||
{ name: 'Bloom Plant', botanicalName: 'Spathiphyllum', description: 'Reliable flowering houseplant.', categories: ['flowering'], careInfo: { waterIntervalDays: 5, light: 'Partial shade', temp: '18-26C' } },
|
||||
{ name: 'Desert Succulent', botanicalName: 'Echeveria elegans', description: 'Classic cactus-like drought tolerant succulent.', categories: ['succulent'], careInfo: { waterIntervalDays: 14, light: 'Sunny', temp: '15-25C' } },
|
||||
{ name: 'Indoor Tree', botanicalName: 'Ficus lyrata', description: 'Beautiful floor tree for bright rooms.', categories: ['tree'], careInfo: { waterIntervalDays: 7, light: 'Bright light', temp: '18-26C' } },
|
||||
{ name: 'Statement Plant', botanicalName: 'Strelitzia nicolai', description: 'Tall oversized statement plant.', categories: ['large'], careInfo: { waterIntervalDays: 7, light: 'Bright light', temp: '18-27C' } },
|
||||
{ name: 'Healing Herb', botanicalName: 'Mentha spicata', description: 'Kitchen herb and medicinal tea herb.', categories: ['medicinal'], careInfo: { waterIntervalDays: 3, light: 'Bright light', temp: '15-25C' } },
|
||||
];
|
||||
|
||||
const cases: Array<[string, string]> = [
|
||||
['hard to kill plant', 'Starter Plant'],
|
||||
['office plant for dark corner', 'Office Shade Plant'],
|
||||
['plant for east window', 'Bright Window Plant'],
|
||||
['plant for sunny window', 'Sunny Aloe'],
|
||||
['non toxic plant for cats', 'Safe Pilea'],
|
||||
['cleaner air plant', 'Air Cleaner Plant'],
|
||||
['bathroom plant', 'Bathroom Fern'],
|
||||
['trailing shelf plant', 'Trailing Vine'],
|
||||
['striped decorative leaves', 'Striped Leaf Plant'],
|
||||
['plant with blooms', 'Bloom Plant'],
|
||||
['cactus-like plant', 'Desert Succulent'],
|
||||
['indoor tree', 'Indoor Tree'],
|
||||
['tall statement plant', 'Statement Plant'],
|
||||
['kitchen tea herb', 'Healing Herb'],
|
||||
];
|
||||
|
||||
it.each(cases)('maps "%s" to %s', (query, expectedName) => {
|
||||
const results = rankHybridEntries(entries, query, 5);
|
||||
expect(results[0].entry.name).toBe(expectedName);
|
||||
});
|
||||
});
|
||||
import { rankHybridEntries } from '../../utils/hybridSearch';
|
||||
|
||||
describe('semantic category matrix', () => {
|
||||
const entries = [
|
||||
{ name: 'Starter Plant', botanicalName: 'Starter easya', description: 'Hard to kill starter plant.', categories: ['easy'], careInfo: { waterIntervalDays: 7, light: 'Bright indirect light', temp: '18-24C' } },
|
||||
{ name: 'Office Shade Plant', botanicalName: 'Shadea officis', description: 'Handles office corners well.', categories: ['low_light'], careInfo: { waterIntervalDays: 8, light: 'Low light', temp: '18-24C' } },
|
||||
{ name: 'Bright Window Plant', botanicalName: 'Brighta windowii', description: 'Thrives in bright rooms.', categories: ['bright_light'], careInfo: { waterIntervalDays: 7, light: 'Bright indirect light', temp: '18-24C' } },
|
||||
{ name: 'Sunny Aloe', botanicalName: 'Aloe vera', description: 'Sun-loving succulent for a south-facing window.', categories: ['sun'], careInfo: { waterIntervalDays: 12, light: 'Sunny', temp: '18-30C' } },
|
||||
{ name: 'Safe Pilea', botanicalName: 'Pilea peperomioides', description: 'Non toxic and pet friendly.', categories: ['pet_friendly'], careInfo: { waterIntervalDays: 7, light: 'Bright indirect light', temp: '18-24C' } },
|
||||
{ name: 'Air Cleaner Plant', botanicalName: 'Chlorophytum comosum', description: 'Helps clean the air indoors.', categories: ['air_purifier'], careInfo: { waterIntervalDays: 6, light: 'Bright to partial shade', temp: '16-24C' } },
|
||||
{ name: 'Bathroom Fern', botanicalName: 'Nephrolepis exaltata', description: 'Loves humidity and steady moisture.', categories: ['high_humidity'], careInfo: { waterIntervalDays: 3, light: 'Partial shade', temp: '16-24C' } },
|
||||
{ name: 'Trailing Vine', botanicalName: 'Epipremnum aureum', description: 'Fast-growing trailing shelf plant.', categories: ['hanging'], careInfo: { waterIntervalDays: 7, light: 'Partial shade to bright', temp: '18-27C' } },
|
||||
{ name: 'Striped Leaf Plant', botanicalName: 'Calathea ornata', description: 'Decorative leaves with striped patterns.', categories: ['patterned'], careInfo: { waterIntervalDays: 5, light: 'Partial shade', temp: '18-25C' } },
|
||||
{ name: 'Bloom Plant', botanicalName: 'Spathiphyllum', description: 'Reliable flowering houseplant.', categories: ['flowering'], careInfo: { waterIntervalDays: 5, light: 'Partial shade', temp: '18-26C' } },
|
||||
{ name: 'Desert Succulent', botanicalName: 'Echeveria elegans', description: 'Classic cactus-like drought tolerant succulent.', categories: ['succulent'], careInfo: { waterIntervalDays: 14, light: 'Sunny', temp: '15-25C' } },
|
||||
{ name: 'Indoor Tree', botanicalName: 'Ficus lyrata', description: 'Beautiful floor tree for bright rooms.', categories: ['tree'], careInfo: { waterIntervalDays: 7, light: 'Bright light', temp: '18-26C' } },
|
||||
{ name: 'Statement Plant', botanicalName: 'Strelitzia nicolai', description: 'Tall oversized statement plant.', categories: ['large'], careInfo: { waterIntervalDays: 7, light: 'Bright light', temp: '18-27C' } },
|
||||
{ name: 'Healing Herb', botanicalName: 'Mentha spicata', description: 'Kitchen herb and medicinal tea herb.', categories: ['medicinal'], careInfo: { waterIntervalDays: 3, light: 'Bright light', temp: '15-25C' } },
|
||||
];
|
||||
|
||||
const cases: Array<[string, string]> = [
|
||||
['hard to kill plant', 'Starter Plant'],
|
||||
['office plant for dark corner', 'Office Shade Plant'],
|
||||
['plant for east window', 'Bright Window Plant'],
|
||||
['plant for sunny window', 'Sunny Aloe'],
|
||||
['non toxic plant for cats', 'Safe Pilea'],
|
||||
['cleaner air plant', 'Air Cleaner Plant'],
|
||||
['bathroom plant', 'Bathroom Fern'],
|
||||
['trailing shelf plant', 'Trailing Vine'],
|
||||
['striped decorative leaves', 'Striped Leaf Plant'],
|
||||
['plant with blooms', 'Bloom Plant'],
|
||||
['cactus-like plant', 'Desert Succulent'],
|
||||
['indoor tree', 'Indoor Tree'],
|
||||
['tall statement plant', 'Statement Plant'],
|
||||
['kitchen tea herb', 'Healing Herb'],
|
||||
];
|
||||
|
||||
it.each(cases)('maps "%s" to %s', (query, expectedName) => {
|
||||
const results = rankHybridEntries(entries, query, 5);
|
||||
expect(results[0].entry.name).toBe(expectedName);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user