feat: Create SubdomainIdentifierGenerator

To be used when creating pods.
This commit is contained in:
Joachim Van Herwegen
2021-02-12 12:52:47 +01:00
parent a28fb0258f
commit 6e2a4b5c2b
5 changed files with 42 additions and 6 deletions

View File

@@ -0,0 +1,14 @@
import { SubdomainIdentifierGenerator } from '../../../../src/pods/generate/SubdomainIdentifierGenerator';
describe('A SubdomainIdentifierGenerator', (): void => {
const base = 'http://test.com/';
const generator = new SubdomainIdentifierGenerator(base);
it('generates identifiers by using the slug as subdomain.', async(): Promise<void> => {
expect(generator.generate('slug')).toEqual({ path: 'http://slug.test.com/' });
});
it('converts slugs using punycode.', async(): Promise<void> => {
expect(generator.generate('sàl/u㋡g')).toEqual({ path: 'http://s-l-u-g.test.com/' });
});
});