theyadev/random-api

View on GitHub
src/__tests__/categories.test.ts

Summary

Maintainability
A
0 mins
Test Coverage
import { getAllCategories, getRandomCategory } from '../index';

test('Categories', async () => {
  expect(await getAllCategories()).toStrictEqual([
    'Animals',
    'Anime',
    'Anti-Malware',
    'Art & Design',
    'Authentication',
    'Blockchain',
    'Books',
    'Business',
    'Calendar',
    'Cloud Storage & File Sharing',
    'Continuous Integration',
    'Cryptocurrency',
    'Currency Exchange',
    'Data Validation',
    'Development',
    'Dictionaries',
    'Documents & Productivity',
    'Email',
    'Entertainment',
    'Environment',
    'Events',
    'Finance',
    'Food & Drink',
    'Games & Comics',
    'Geocoding',
    'Government',
    'Health',
    'Jobs',
    'Machine Learning',
    'Music',
    'News',
    'Open Data',
    'Open Source Projects',
    'Patent',
    'Personality',
    'Phone',
    'Photography',
    'Programming',
    'Science & Math',
    'Security',
    'Shopping',
    'Social',
    'Sports & Fitness',
    'Test Data',
    'Text Analysis',
    'Tracking',
    'Transportation',
    'URL Shorteners',
    'Vehicle',
    'Video',
    'Weather',
  ]);
});

test('Categories Random', async () => {
  expect((await getRandomCategory(5)).length).toBe(5);
});