-
-
Notifications
You must be signed in to change notification settings - Fork 217
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2178 from marioneyraud/front-github-actions-button
Front add Gihub actions button
- Loading branch information
Showing
15 changed files
with
144 additions
and
9 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
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 |
---|---|---|
@@ -1 +1,5 @@ | ||
export interface SetupService {} | ||
import { Project } from '@/springboot/domain/Project'; | ||
|
||
export interface SetupService { | ||
addGithubActions(project: Project): Promise<void>; | ||
} |
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
8 changes: 8 additions & 0 deletions
8
src/main/webapp/app/springboot/primary/generator/setup-generator/SetupGenerator.vue
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
15 changes: 15 additions & 0 deletions
15
src/main/webapp/app/springboot/secondary/SetupRepository.ts
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,15 @@ | ||
import { SetupService } from '@/springboot/domain/SetupService'; | ||
import { AxiosHttp } from '@/http/AxiosHttp'; | ||
import { ProjectHistoryService } from '@/common/domain/ProjectHistoryService'; | ||
import { RestProject, toRestProject } from '@/springboot/secondary/RestProject'; | ||
import { Project } from '@/springboot/domain/Project'; | ||
|
||
export default class SetupRepository implements SetupService { | ||
constructor(private axiosHttp: AxiosHttp, private projectHistoryService: ProjectHistoryService) {} | ||
private async postAndGetHistory(url: string, restProject: RestProject): Promise<void> { | ||
await this.axiosHttp.post(url, restProject).then(() => this.projectHistoryService.get(restProject.folder)); | ||
} | ||
async addGithubActions(project: Project): Promise<void> { | ||
await this.postAndGetHistory('api/developer-tools/github-actions', toRestProject(project)); | ||
} | ||
} |
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
9 changes: 7 additions & 2 deletions
9
src/test/javascript/spec/springboot/domain/SetupService.fixture.ts
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 |
---|---|---|
@@ -1,5 +1,10 @@ | ||
import { SetupService } from '../../../../../main/webapp/app/springboot/domain/SetupService'; | ||
import sinon, { SinonStub } from 'sinon'; | ||
|
||
export interface SetupServiceFixture extends SetupService {} | ||
export interface SetupServiceFixture extends SetupService { | ||
addGithubActions: SinonStub; | ||
} | ||
|
||
export const stubSetupService = (): SetupServiceFixture => ({}); | ||
export const stubSetupService = (): SetupServiceFixture => ({ | ||
addGithubActions: sinon.stub(), | ||
}); |
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
27 changes: 27 additions & 0 deletions
27
src/test/javascript/spec/springboot/secondary/SetupRepository.spec.ts
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,27 @@ | ||
import { stubProjectHistoryService } from '../../common/domain/ProjectHistoryService.fixture'; | ||
import { stubAxiosHttp } from '../../http/AxiosHttpStub'; | ||
import { Project } from '../../../../../main/webapp/app/springboot/domain/Project'; | ||
import { createProject } from '../domain/Project.fixture'; | ||
import { RestProject, toRestProject } from '../../../../../main/webapp/app/springboot/secondary/RestProject'; | ||
import SetupRepository from '../../../../../main/webapp/app/springboot/secondary/SetupRepository'; | ||
|
||
const PROJECT_FOLDER = 'folder/path'; | ||
|
||
describe('SetupRepository', () => { | ||
it('should add Github actions', async () => { | ||
const projectHistoryService = stubProjectHistoryService(); | ||
const axiosHttpStub = stubAxiosHttp(); | ||
axiosHttpStub.post.resolves(); | ||
const setupRepository = new SetupRepository(axiosHttpStub, projectHistoryService); | ||
const project: Project = createProject({ folder: PROJECT_FOLDER }); | ||
|
||
await setupRepository.addGithubActions(project); | ||
|
||
const expectedRestProject: RestProject = toRestProject(project); | ||
const [uri, payload] = axiosHttpStub.post.getCall(0).args; | ||
expect(uri).toBe('api/developer-tools/github-actions'); | ||
expect(payload).toEqual<RestProject>(expectedRestProject); | ||
const [projectFolder] = projectHistoryService.get.getCall(0).args; | ||
expect(projectFolder).toBe(PROJECT_FOLDER); | ||
}); | ||
}); |