diff options
| author | DivisionByZero <[email protected]> | 2024-02-11 11:29:51 +0100 |
|---|---|---|
| committer | GitHub <[email protected]> | 2024-02-11 10:29:51 +0000 |
| commit | 9aab7c2429b50c0f6e8bd1908344f9ff92912f5d (patch) | |
| tree | a30e8d5a6704c8c5011757e48dba4e1bba5ac638 /test/modules | |
| parent | 0e4b93fe42ed6c63970c629e9b5e3ff415e5711c (diff) | |
| download | faker-9aab7c2429b50c0f6e8bd1908344f9ff92912f5d.tar.xz faker-9aab7c2429b50c0f6e8bd1908344f9ff92912f5d.zip | |
feat(food): new module (#2484)
Co-authored-by: Matt Mayer <[email protected]>
Co-authored-by: Matt Mayer <[email protected]>
Diffstat (limited to 'test/modules')
| -rw-r--r-- | test/modules/__snapshots__/food.spec.ts.snap | 55 | ||||
| -rw-r--r-- | test/modules/food.spec.ts | 89 |
2 files changed, 144 insertions, 0 deletions
diff --git a/test/modules/__snapshots__/food.spec.ts.snap b/test/modules/__snapshots__/food.spec.ts.snap new file mode 100644 index 00000000..5c3b894e --- /dev/null +++ b/test/modules/__snapshots__/food.spec.ts.snap @@ -0,0 +1,55 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`food > 42 > adjective 1`] = `"golden"`; + +exports[`food > 42 > description 1`] = `"A succulent venison steak, encased in a sour liquorice root crust, served with a side of bay leaves mashed broccoli."`; + +exports[`food > 42 > dish 1`] = `"Caraway Seed-crusted Rabbit"`; + +exports[`food > 42 > ethnicCategory 1`] = `"Gujarati"`; + +exports[`food > 42 > fruit 1`] = `"fig"`; + +exports[`food > 42 > ingredient 1`] = `"flat mushrooms"`; + +exports[`food > 42 > meat 1`] = `"goose"`; + +exports[`food > 42 > spice 1`] = `"dhansak"`; + +exports[`food > 42 > vegetable 1`] = `"cos lettuce"`; + +exports[`food > 1211 > adjective 1`] = `"tender"`; + +exports[`food > 1211 > description 1`] = `"Three tamari with capers, zucchini, onion, onion and rice paper. With a side of baked feijoa, and your choice of persimmon or slivered almonds."`; + +exports[`food > 1211 > dish 1`] = `"Lasagne"`; + +exports[`food > 1211 > ethnicCategory 1`] = `"Texan"`; + +exports[`food > 1211 > fruit 1`] = `"strawberry"`; + +exports[`food > 1211 > ingredient 1`] = `"turmeric"`; + +exports[`food > 1211 > meat 1`] = `"turkey"`; + +exports[`food > 1211 > spice 1`] = `"tagine"`; + +exports[`food > 1211 > vegetable 1`] = `"sun dried tomatoes"`; + +exports[`food > 1337 > adjective 1`] = `"fluffy"`; + +exports[`food > 1337 > description 1`] = `"A slow-roasted White-winged Scoter with a fluffy, moist exterior. Stuffed with dried apricot and covered in kiwi fruit sauce. Sides with carrot puree and wild turnips."`; + +exports[`food > 1337 > dish 1`] = `"Cauliflower-infused Ostrich"`; + +exports[`food > 1337 > ethnicCategory 1`] = `"Czech"`; + +exports[`food > 1337 > fruit 1`] = `"custard apple"`; + +exports[`food > 1337 > ingredient 1`] = `"coconut water"`; + +exports[`food > 1337 > meat 1`] = `"emu"`; + +exports[`food > 1337 > spice 1`] = `"chilli pepper"`; + +exports[`food > 1337 > vegetable 1`] = `"carrot"`; diff --git a/test/modules/food.spec.ts b/test/modules/food.spec.ts new file mode 100644 index 00000000..473a191b --- /dev/null +++ b/test/modules/food.spec.ts @@ -0,0 +1,89 @@ +import { describe, expect, it } from 'vitest'; +import { faker } from '../../src'; +import { seededTests } from '../support/seeded-runs'; +import { times } from './../support/times'; + +const NON_SEEDED_BASED_RUN = 5; + +describe('food', () => { + seededTests(faker, 'food', (t) => { + t.it('adjective'); + + t.it('description'); + + t.it('dish'); + + t.it('ethnicCategory'); + + t.it('fruit'); + + t.it('ingredient'); + + t.it('meat'); + + t.it('spice'); + + t.it('vegetable'); + }); + + describe.each(times(NON_SEEDED_BASED_RUN).map(() => faker.seed()))( + 'random seeded tests for seed %i', + () => { + describe('adjective', () => { + it(`should return random value from adjective array`, () => { + const actual = faker.food.adjective(); + expect(faker.definitions.food.adjective).toContain(actual); + }); + }); + + describe('dish', () => { + it(`should be a capitalized string`, () => { + const actual = faker.food.dish(); + expect(actual[0]).toBe(actual[0].toUpperCase()); + }); + }); + + describe('ethnicCategory', () => { + it(`should return random value from ethnic_category array`, () => { + const actual = faker.food.ethnicCategory(); + expect(faker.definitions.food.ethnic_category).toContain(actual); + }); + }); + + describe('fruit', () => { + it(`should return random value from fruit array`, () => { + const actual = faker.food.fruit(); + expect(faker.definitions.food.fruit).toContain(actual); + }); + }); + + describe('ingredient', () => { + it(`should return random value from ingredient array`, () => { + const actual = faker.food.ingredient(); + expect(faker.definitions.food.ingredient).toContain(actual); + }); + }); + + describe('meat', () => { + it(`should return random value from meat array`, () => { + const actual = faker.food.meat(); + expect(faker.definitions.food.meat).toContain(actual); + }); + }); + + describe('spice', () => { + it(`should return random value from spice array`, () => { + const actual = faker.food.spice(); + expect(faker.definitions.food.spice).toContain(actual); + }); + }); + + describe('vegetable', () => { + it(`should return random value from vegetable array`, () => { + const actual = faker.food.vegetable(); + expect(faker.definitions.food.vegetable).toContain(actual); + }); + }); + } + ); +}); |
