Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(i18n-DE): city #338

Merged
merged 2 commits into from
Dec 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
2 changes: 1 addition & 1 deletion packages/falso/src/lib/city.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { FakeOptions, fake } from './core/core';
import { data } from './city.json';
import { data } from './city.i18n.json';

/**
* Generate a random city.
Expand Down
83 changes: 83 additions & 0 deletions packages/falso/src/lib/i18n/de/city.i18n.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
{
"data": [
"Aachen",
"Augsburg",
"Bergisch Gladbach",
"Berlin",
"Bielefeld",
"Bochum",
"Bonn",
"Bottrop",
"Braunschweig",
"Bremen",
"Bremerhaven",
"Chemnitz",
"Köln",
"Darmstadt",
"Dortmund",
"Dresden",
"Duisburg",
"Düsseldorf",
"Erfurt",
"Erlangen",
"Essen",
"Frankfurt am Main",
"Freiburg im Breisgau",
"Fürth",
"Gelsenkirchen",
"Göttingen",
"Hagen",
"Halle (Saale)",
"Hamburg",
"Hamm",
"Hanover (Hannover)",
"Heidelberg",
"Heilbronn",
"Herne",
"Hildesheim",
"Ingolstadt",
"Jena",
"Karlsruhe",
"Kassel",
"Kiel",
"Koblenz",
"Krefeld",
"Leipzig",
"Leverkusen",
"Lübeck",
"Ludwigshafen am Rhein",
"Magdeburg",
"Mainz",
"Mannheim",
"Moers",
"Mönchengladbach",
"Mülheim an der Ruhr",
"München",
"Münster",
"Neuss",
"Nürnberg",
"Oberhausen",
"Offenbach am Main",
"Oldenburg",
"Osnabrück",
"Paderborn",
"Pforzheim",
"Potsdam",
"Recklinghausen",
"Regensburg",
"Remscheid",
"Reutlingen",
"Rostock",
"Saarbrücken",
"Salzgitter",
"Siegen",
"Solingen",
"Stuttgart",
"Trier",
"Ulm",
"Wiesbaden",
"Wolfsburg",
"Wuppertal",
"Würzburg"
]
}
22 changes: 22 additions & 0 deletions packages/falso/src/lib/i18n/de/city.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { FakeOptions, fake } from '../../core/core';
import { data } from './city.i18n.json';

/**
* Generate a random city.
*
* @category Address
*
* @example
*
* randCity()
*
* @example
*
* randCity({ length: 10 })
*
*/
export function randCity<Options extends FakeOptions = never>(
options?: Options
) {
return fake(data, options);
}
1 change: 1 addition & 0 deletions packages/falso/src/lib/i18n/de/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export { randBird } from './bird';
export { randState } from './state';
export { randStateAbbr } from './state-abbr';
export { randCity } from './city';
27 changes: 27 additions & 0 deletions packages/falso/src/tests/city.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { randCity } from '../lib/city';
import { data } from '../lib/city.i18n.json';

import { randCity as deRandCity } from '../lib/i18n/de';
import { data as deData } from '../lib/i18n/de/city.i18n.json';

describe('randCity', () => {
describe('EN', () => {
it('should create one random city', () => {
const randomCity = randCity();

expect(randomCity).toBeTruthy();
expect(typeof randomCity).toEqual('string');
expect(data).toEqual(expect.arrayContaining([randomCity]));
});
});

describe('DE', () => {
it('should create one random city', () => {
const randomCity = deRandCity();

expect(randomCity).toBeTruthy();
expect(typeof randomCity).toEqual('string');
expect(deData).toEqual(expect.arrayContaining([randomCity]));
});
});
});