This repository has been archived by the owner on Feb 27, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test for DocProjectGenerator and refactor mocks
- Loading branch information
1 parent
3d35581
commit f086a91
Showing
24 changed files
with
241 additions
and
182 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import { Container, interfaces } from "inversify"; | ||
import { TYPES } from "./types"; | ||
|
||
import CliGenerateFacade from "./src/cli/CliGenerateFacade"; | ||
import ICliGenerateFacade from "./src/cli/interfaces/ICliGenerateFacade"; | ||
|
||
import ConfigManager from "./src/config/ConfigManager"; | ||
import IConfigManager from "./src/config/interfaces/IConfigManager"; | ||
import IOutputConfig from "./src/config/interfaces/IOutputConfig"; | ||
import IProjectConfig from "./src/config/interfaces/IProjectConfig"; | ||
import IScriptValidationRules from "./src/config/interfaces/IScriptValidationRules"; | ||
import OutputConfig from "./src/config/OutputConfig"; | ||
import ProjectConfig from "./src/config/ProjectConfig"; | ||
import ScriptValidationRules from "./src/config/ScriptValidationRules"; | ||
|
||
import DocProjectGenerator from "./src/generator/DocProjectGenerator"; | ||
import DocumentationExtractor from "./src/generator/DocumentationExtractor"; | ||
import IDocProjectGenerator from "./src/generator/interfaces/IDocProjectGenerator"; | ||
import IDocumentationExtractor from "./src/generator/interfaces/IDocumentationExtractor"; | ||
|
||
import IJSDocParser from "./src/parser/interfaces/IJSDocParser"; | ||
import JSDocParser from "./src/parser/JSDocParser"; | ||
|
||
import GMProject from "./src/gm_project/GMProject"; | ||
import IGMProject from "./src/gm_project/interfaces/IGMProject"; | ||
import IScriptValidator from "./src/validation/interfaces/IScriptValidator"; | ||
import IValidationRule from "./src/validation/interfaces/IValidationRule"; | ||
import ScriptValidator from "./src/validation/ScriptValidator"; | ||
import ValidableScript from "./src/validation/ValidableScript"; | ||
import ValidationRule from "./src/validation/ValidationRule"; | ||
|
||
/* tslint:disable:max-line-length */ | ||
const container = new Container(); | ||
|
||
// Validation | ||
container.bind<interfaces.Newable<IValidationRule<ValidableScript>>>(TYPES.IValidationRule).toConstructor(ValidationRule); | ||
container.bind<IScriptValidator>(TYPES.IScriptValidator).to(ScriptValidator); | ||
|
||
// Generator | ||
container.bind<IDocumentationExtractor>(TYPES.IDocumentationExtractor).to(DocumentationExtractor); | ||
|
||
// Parser | ||
container.bind<IJSDocParser>(TYPES.IJSDocParser).to(JSDocParser); | ||
container.bind<IDocProjectGenerator>(TYPES.IDocProjectGenerator).to(DocProjectGenerator); | ||
|
||
// Config | ||
container.bind<IConfigManager>(TYPES.IConfigManager).to(ConfigManager); | ||
container.bind<IOutputConfig>(TYPES.IOutputConfig).to(OutputConfig); | ||
container.bind<IProjectConfig>(TYPES.IProjectConfig).to(ProjectConfig); | ||
container.bind<interfaces.Newable<IProjectConfig>>(TYPES.NewableOfIProjectConfig).toConstructor(ProjectConfig); | ||
container.bind<IScriptValidationRules>(TYPES.IScriptValidationRules).to(ScriptValidationRules); | ||
|
||
// Cli | ||
container.bind<ICliGenerateFacade>(TYPES.ICliGenerateFacade).to(CliGenerateFacade); | ||
|
||
// GM Project | ||
container.bind<IGMProject>(TYPES.IGMProject).to(GMProject); | ||
|
||
export default container; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import IGMResource from "./IGMResource"; | ||
|
||
export default interface IGMScript extends IGMResource { | ||
readonly filepath: string; | ||
subScripts(): IterableIterator<[string, string]>; | ||
loadFromString(str: string): void; | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { injectable } from "inversify"; | ||
import DocScript from "../../src/doc_models/DocScript"; | ||
import IDocumentationExtractor from "../../src/generator/interfaces/IDocumentationExtractor"; | ||
import IGMScript from "../../src/gm_project/interfaces/IGMScript"; | ||
|
||
/* tslint:disable:completed-docs */ | ||
|
||
@injectable() | ||
export default class MockDocumentationExtractor implements IDocumentationExtractor { | ||
public extractDocScripts(_script: IGMScript): DocScript[] { | ||
throw new Error("Method not implemented."); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { injectable } from "inversify"; | ||
import IGMFolder from "../../src/gm_project/interfaces/IGMFolder"; | ||
import IGMProject from "../../src/gm_project/interfaces/IGMProject"; | ||
import GMFolderMock from "./MockGMFolder.mock"; | ||
|
||
/* tslint:disable:completed-docs */ | ||
|
||
@injectable() | ||
export default class MockGMProject extends GMFolderMock implements IGMProject { | ||
public parent: IGMFolder | null = null; | ||
public path: string; | ||
public mockChildren: IGMFolder[]; | ||
constructor(name: string, mockChildren: IGMFolder[], path: string) { | ||
super(name, mockChildren); | ||
this.path = path; | ||
} | ||
get children(): IterableIterator<IGMFolder> { | ||
return this.mockChildren[Symbol.iterator](); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { injectable } from "inversify"; | ||
import IGMFolder from "../../src/gm_project/interfaces/IGMFolder"; | ||
import IGMScript from "../../src/gm_project/interfaces/IGMScript"; | ||
|
||
/* tslint:disable:completed-docs */ | ||
|
||
@injectable() | ||
export default class MockGMScript implements IGMScript { | ||
public fullpath: string; | ||
public name: string; | ||
public filepath: string; | ||
public parent: IGMFolder | null = null; | ||
public mockFullpath: string; | ||
|
||
constructor(name: string, fullpath: string, filepath: string) { | ||
this.name = name; | ||
this.fullpath = fullpath; | ||
this.filepath = filepath; | ||
} | ||
public * subScripts(): IterableIterator<[string, string]> { | ||
throw new Error("Method not implemented."); | ||
} | ||
public loadFromString(_str: string): void { | ||
throw new Error("Method not implemented."); | ||
} | ||
public match(_pattern: string): boolean { | ||
throw new Error("Method not implemented."); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.