diff --git a/packages/oslo-generator-json-webuniversum/config.json b/packages/oslo-generator-json-webuniversum/config.json index bc898ba..a12a25a 100644 --- a/packages/oslo-generator-json-webuniversum/config.json +++ b/packages/oslo-generator-json-webuniversum/config.json @@ -1,28 +1,5 @@ { "baseURI": "http://example.org/ns/domain#", - "entities": [ - { - "id": "http://example.org/id/class/1", - "vocabularyLabel": { - "en": "VocTestClass" - }, - "applicationProfileLabel": { - "en": "ApTestClass" - }, - "vocabularyDefinition": { - "en": "VocDefinition" - }, - "applicationProfileDefinition": { - "en": "ApDefinition" - }, - "vocabularyUsageNote": { - "en": "VocUsageNote" - }, - "applicationProfileUsageNote": { - "en": "ApUsageNote" - } - } - ], "classes": [ { "id": "http://example.org/id/class/1", diff --git a/packages/oslo-generator-json-webuniversum/lib/config/JsonWebuniversumGenerationServiceConfiguration.ts b/packages/oslo-generator-json-webuniversum/lib/config/JsonWebuniversumGenerationServiceConfiguration.ts index 2292f78..114be2f 100644 --- a/packages/oslo-generator-json-webuniversum/lib/config/JsonWebuniversumGenerationServiceConfiguration.ts +++ b/packages/oslo-generator-json-webuniversum/lib/config/JsonWebuniversumGenerationServiceConfiguration.ts @@ -39,6 +39,7 @@ export class JsonWebuniversumGenerationServiceConfiguration private _specificationType: SpecificationType | undefined; public async createFromCli(params: YargsParams): Promise { + console.log(params); this._input = params.input; this._output = params.output; this._language = params.language; diff --git a/packages/oslo-generator-json-webuniversum/test/JsonWebuniversumGenerationService.unit.test.ts b/packages/oslo-generator-json-webuniversum/test/JsonWebuniversumGenerationService.unit.test.ts index 618dcd8..1cdb554 100644 --- a/packages/oslo-generator-json-webuniversum/test/JsonWebuniversumGenerationService.unit.test.ts +++ b/packages/oslo-generator-json-webuniversum/test/JsonWebuniversumGenerationService.unit.test.ts @@ -86,29 +86,6 @@ describe('JsonWebuniversumGenerationServiceConfiguration', () => { JSON.stringify( { baseURI: 'http://example.org/ns/domain#', - entities: [ - { - id: 'http://example.org/id/class/1', - vocabularyLabel: { - en: 'VocTestClass', - }, - applicationProfileLabel: { - en: 'ApTestClass', - }, - vocabularyDefinition: { - en: 'VocDefinition', - }, - applicationProfileDefinition: { - en: 'ApDefinition', - }, - vocabularyUsageNote: { - en: 'VocUsageNote', - }, - applicationProfileUsageNote: { - en: 'ApUsageNote', - }, - }, - ], classes: [ { id: 'http://example.org/id/class/1', diff --git a/packages/oslo-generator-json-webuniversum/test/JsonWebuniversumGenerationServiceConfiguration.unit.test.ts b/packages/oslo-generator-json-webuniversum/test/JsonWebuniversumGenerationServiceConfiguration.unit.test.ts index b57786f..c6a5888 100644 --- a/packages/oslo-generator-json-webuniversum/test/JsonWebuniversumGenerationServiceConfiguration.unit.test.ts +++ b/packages/oslo-generator-json-webuniversum/test/JsonWebuniversumGenerationServiceConfiguration.unit.test.ts @@ -2,52 +2,58 @@ * @group unit */ import 'reflect-metadata'; -import { JsonWebuniversumGenerationServiceConfiguration } - from '../lib/config/JsonWebuniversumGenerationServiceConfiguration'; +import { + JsonWebuniversumGenerationServiceConfiguration, +} from '../lib/config/JsonWebuniversumGenerationServiceConfiguration'; describe('JsonWebuniversumGenerationServiceConfiguration', () => { - let params: any; - - beforeEach(() => { - params = { - input: 'test.jsonld', - output: 'config.json', - language: 'en', - apTemplateMetadata: 'ap-markdown.md', - vocTemplateMetadata: 'voc-markdown.md', - }; - }); - - it('should set its variables using the parameters received from the CLI', async () => { - const config = new JsonWebuniversumGenerationServiceConfiguration(); - await config.createFromCli(params); - - expect((config)._input).toBeDefined(); - expect((config)._output).toBeDefined(); - expect((config)._language).toBeDefined(); - }); - - it('should throw an error when "input" is undefined or otherwise return its value', async () => { - const config = new JsonWebuniversumGenerationServiceConfiguration(); - - expect(() => config.input).toThrow(new Error('Trying to access "input" before it was set.')); - await config.createFromCli(params); - expect(config.input).toBe('test.jsonld'); - }); - - it('should throw an error when "output" is undefined or otherwise return its value', async () => { - const config = new JsonWebuniversumGenerationServiceConfiguration(); - - expect(() => config.output).toThrow(new Error('Trying to access "output" before it was set.')); - await config.createFromCli(params); - expect(config.output).toBe('config.json'); - }); - - it('should throw an error when "language" is undefined or otherwise return its value', async () => { - const config = new JsonWebuniversumGenerationServiceConfiguration(); - - expect(() => config.language).toThrow(new Error('Trying to access "language" before it was set.')); - await config.createFromCli(params); - expect(config.language).toBe('en'); - }); -}) \ No newline at end of file + let params: any; + + beforeEach(() => { + params = { + input: 'test.jsonld', + output: 'config.json', + language: 'en', + specificationType: 'Vocabulary', + }; + }); + + it('should set its variables using the parameters received from the CLI', async () => { + const config = new JsonWebuniversumGenerationServiceConfiguration(); + await config.createFromCli(params); + + expect((config)._input).toBeDefined(); + expect((config)._output).toBeDefined(); + expect((config)._language).toBeDefined(); + }); + + it('should throw an error when "input" is undefined or otherwise return its value', async () => { + const config = new JsonWebuniversumGenerationServiceConfiguration(); + + expect(() => config.input).toThrow( + new Error('Trying to access "input" before it was set.'), + ); + await config.createFromCli(params); + expect(config.input).toBe('test.jsonld'); + }); + + it('should throw an error when "output" is undefined or otherwise return its value', async () => { + const config = new JsonWebuniversumGenerationServiceConfiguration(); + + expect(() => config.output).toThrow( + new Error('Trying to access "output" before it was set.'), + ); + await config.createFromCli(params); + expect(config.output).toBe('config.json'); + }); + + it('should throw an error when "language" is undefined or otherwise return its value', async () => { + const config = new JsonWebuniversumGenerationServiceConfiguration(); + + expect(() => config.language).toThrow( + new Error('Trying to access "language" before it was set.'), + ); + await config.createFromCli(params); + expect(config.language).toBe('en'); + }); +});