1import { vol } from 'memfs'; 2 3import { getResolvedLocalesAsync } from '../getResolvedLocales'; 4 5describe(getResolvedLocalesAsync, () => { 6 it(`resolves nothing if locales are not defined`, async () => { 7 expect(await getResolvedLocalesAsync('/', {})).toEqual({}); 8 }); 9 it(`resolves locales`, async () => { 10 vol.fromJSON( 11 { 12 'foobar.json': JSON.stringify({ foo: 'bar' }), 13 'foobar2.json': JSON.stringify({ bar: true }), 14 }, 15 '/' 16 ); 17 expect( 18 await getResolvedLocalesAsync('/', { 19 locales: { 20 'en-US': './foobar.json', 21 'nl-NL': './foobar2.json', 22 }, 23 }) 24 ).toEqual({ 25 'en-US': { 26 foo: 'bar', 27 }, 28 'nl-NL': { 29 bar: true, 30 }, 31 }); 32 }); 33}); 34