-
-
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 #1876 from swarajsaaj/feature/autofill_projectdetails
Feature/autofill projectdetails
- Loading branch information
Showing
13 changed files
with
250 additions
and
27 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
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,24 @@ | ||
import { defineStore } from 'pinia'; | ||
import { Project } from '@/springboot/domain/Project'; | ||
|
||
const emptyProject = (): Project => ({ | ||
folder: '', | ||
}); | ||
|
||
export const useProjectStore = defineStore('ProjectStore', { | ||
state: () => { | ||
return { | ||
project: emptyProject(), | ||
}; | ||
}, | ||
|
||
getters: { | ||
getProject: state => state.project, | ||
}, | ||
|
||
actions: { | ||
async setProject(project: Project) { | ||
this.project = 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
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
14 changes: 14 additions & 0 deletions
14
src/test/javascript/spec/springboot/primary/ProjectStore.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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import sinon, { SinonStub } from 'sinon'; | ||
|
||
export interface ProjectStoreFixture { | ||
getProject: SinonStub; | ||
setProject: SinonStub; | ||
$subscribe: SinonStub; | ||
} | ||
|
||
export const stubProjectStore = (): ProjectStoreFixture => | ||
({ | ||
getProject: sinon.stub(), | ||
setProject: sinon.stub(), | ||
$subscribe: sinon.stub(), | ||
} as ProjectStoreFixture); |
35 changes: 35 additions & 0 deletions
35
src/test/javascript/spec/springboot/primary/ProjectStore.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,35 @@ | ||
import { createPinia, setActivePinia } from 'pinia'; | ||
import { useProjectStore } from '@/springboot/primary/ProjectStore'; | ||
import { Project } from '@/springboot/domain/Project'; | ||
import { createProject } from '../domain/Project.fixture'; | ||
|
||
describe('ProjectStore', () => { | ||
beforeEach(() => { | ||
setActivePinia(createPinia()); | ||
}); | ||
|
||
it('should have an empty proejct by default', () => { | ||
const projectStore = useProjectStore(); | ||
|
||
expect(projectStore.project).toEqual<Project>({ | ||
folder: '', | ||
}); | ||
}); | ||
|
||
it('should get project', () => { | ||
const projectStore = useProjectStore(); | ||
|
||
expect(projectStore.getProject).toEqual<Project>({ | ||
folder: '', | ||
}); | ||
}); | ||
|
||
it('should set project', () => { | ||
const projectStore = useProjectStore(); | ||
const project = createProject(); | ||
|
||
projectStore.setProject(project); | ||
|
||
expect(projectStore.getProject).toEqual<Project>(project); | ||
}); | ||
}); |
Oops, something went wrong.