Skip to content
This repository has been archived by the owner on Jul 23, 2019. It is now read-only.

Commit

Permalink
fix: don't rename url parameters for shared state (#574)
Browse files Browse the repository at this point in the history
  • Loading branch information
edewit authored Mar 25, 2019
1 parent 26c29a7 commit 191f99d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
15 changes: 15 additions & 0 deletions projects/ngx-launcher/src/lib/model/projectile.model.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,21 @@ describe('State saving and restoring', () => {
expect(_newState).toEqual(newState);
}));

it('should restore shared state', () => {
class SharedStateProjectile<T> extends Projectile<T> {
protected searchParams() {
// tslint:disable-next-line:max-line-length
return new URLSearchParams('?selectedSection=&shared=%7B%22projectName%22%3A%22projectName%22%2C%22projectVersion%22%3A%22%22%2C%22groupId%22%3A%22%22%2C%22mavenArtifact%22%3A%22some-value%22%2C%22space%22%3A%22%22%2C%22targetEnvironment%22%3A%22%22%7D');
}
}

const projectile = new SharedStateProjectile();
projectile.sharedState.state;
projectile.restore('shared', projectile.getSavedState('shared'));
expect(projectile.sharedState.state.projectName).toBe('projectName');
expect(projectile.sharedState.state.mavenArtifact).toBe('some-value');
});

it('should reset the state of the component', async(() => {
const projectile = new TestableProjectile<any>();
projectile.setState('newState', new StepState<any>({ 'param1': 'value1' }, [{ name: 'p1', value: 'param1' }]));
Expand Down
4 changes: 2 additions & 2 deletions projects/ngx-launcher/src/lib/model/projectile.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ export class Projectile<T> {
{ name: 'projectName', value: 'projectName' },
{ name: 'projectVersion', value: 'projectVersion' },
{ name: 'groupId', value: 'groupId' },
{ name: 'artifactId', value: 'mavenArtifact' },
{ name: 'space', value: 'spacePath' },
{ name: 'mavenArtifact', value: 'mavenArtifact' },

This comment has been minimized.

Copy link
@gastaldi

gastaldi Mar 25, 2019

Contributor

@edewit this broke the backend. the expected parameter is artifactId

{ name: 'spacePath', value: 'spacePath' },
{ name: 'targetEnvironment', value: 'targetEnvironment' }
]);
this.setState('shared', state);
Expand Down

0 comments on commit 191f99d

Please sign in to comment.