Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

apply prettier to templates #26550

Merged
merged 2 commits into from
Jun 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@
<div class="d-flex justify-content-center">
<div class="col-md-8">
<h1>__jhiTranslateTag__('activate.title')</h1>
@if (success()) {
<div class="alert alert-success">
<span>__jhiTranslateTag__('activate.messages.success')</span>
<a class="alert-link" routerLink="/login">__jhiTranslateTag__('global.messages.info.authenticated.link')</a>.
</div>
}
@if (error()) {
<div class="alert alert-danger">__jhiTranslateTag__('activate.messages.error')</div>
}
@if (success()) {
<div class="alert alert-success">
<span>__jhiTranslateTag__('activate.messages.success')</span>
<a class="alert-link" routerLink="/login">__jhiTranslateTag__('global.messages.info.authenticated.link')</a>.
</div>
}
@if (error()) {
<div class="alert alert-danger">__jhiTranslateTag__('activate.messages.error')</div>
}
</div>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,20 @@ import ActivateComponent from './activate.component';
describe('ActivateComponent', () => {
let comp: ActivateComponent;

beforeEach(
waitForAsync(() => {
TestBed.configureTestingModule({
imports: [ActivateComponent],
providers: [
provideHttpClient(),
{
provide: ActivatedRoute,
useValue: { queryParams: of({ key: 'ABC123' }) },
},
],
})
.overrideTemplate(ActivateComponent, '')
.compileComponents();
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
imports: [ActivateComponent],
providers: [
provideHttpClient(),
{
provide: ActivatedRoute,
useValue: { queryParams: of({ key: 'ABC123' }) },
},
],
})
);
.overrideTemplate(ActivateComponent, '')
.compileComponents();
}));

beforeEach(() => {
const fixture = TestBed.createComponent(ActivateComponent);
Expand All @@ -58,7 +56,7 @@ describe('ActivateComponent', () => {
tick();

expect(service.get).toHaveBeenCalledWith('ABC123');
})
}),
));

it('should set set success to true upon successful activation', inject(
Expand All @@ -71,7 +69,7 @@ describe('ActivateComponent', () => {

expect(comp.error()).toBe(false);
expect(comp.success()).toBe(true);
})
}),
));

it('should set set error to true upon activation failure', inject(
Expand All @@ -84,6 +82,6 @@ describe('ActivateComponent', () => {

expect(comp.error()).toBe(true);
expect(comp.success()).toBe(false);
})
}),
));
});
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export default class ActivateComponent implements OnInit {
ngOnInit(): void {
this.route.queryParams.pipe(mergeMap(params => this.activateService.get(params.key))).subscribe({
next: () => this.success.set(true),
error: () => this.error.set(true)
error: () => this.error.set(true),
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ describe('PasswordResetFinishComponent', () => {

expect(service.save).toHaveBeenCalledWith('XYZPDQ', 'password');
expect(comp.success()).toBe(true);
})
}),
));

it('should notify of generic error', inject(
Expand All @@ -111,6 +111,6 @@ describe('PasswordResetFinishComponent', () => {
expect(service.save).toHaveBeenCalledWith('XYZPDQ', 'password');
expect(comp.success()).toBe(false);
expect(comp.error()).toBe(true);
})
}),
));
});
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ export default class PasswordResetFinishComponent implements OnInit, AfterViewIn
this.doNotMatch.set(true);
} else {
this.passwordResetFinishService.save(this.key(), newPassword).subscribe({
next: () => (this.success.set(true)),
error: () => (this.error.set(true)),
next: () => this.success.set(true),
error: () => this.error.set(true),
});
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,7 @@ describe('PasswordResetInitComponent', () => {

it('no notification of success upon error response', inject([PasswordResetInitService], (service: PasswordResetInitService) => {
const err = { status: 503, data: 'something else' };
jest.spyOn(service, 'save').mockReturnValue(
throwError(() => err)
);
jest.spyOn(service, 'save').mockReturnValue(throwError(() => err));
comp.resetRequestForm.patchValue({
email: '[email protected]',
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,13 @@ describe('PasswordStrengthBarComponent', () => {
let comp: PasswordStrengthBarComponent;
let fixture: ComponentFixture<PasswordStrengthBarComponent>;

beforeEach(
waitForAsync(() => {
TestBed.configureTestingModule({
imports: [PasswordStrengthBarComponent],
})
.overrideTemplate(PasswordStrengthBarComponent, '')
.compileComponents();
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
imports: [PasswordStrengthBarComponent],
})
);
.overrideTemplate(PasswordStrengthBarComponent, '')
.compileComponents();
}));

beforeEach(() => {
fixture = TestBed.createComponent(PasswordStrengthBarComponent);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,14 @@ describe('PasswordComponent', () => {
let fixture: ComponentFixture<PasswordComponent>;
let service: PasswordService;

beforeEach(
waitForAsync(() => {
TestBed.configureTestingModule({
imports: [PasswordComponent],
providers: [FormBuilder, AccountService, provideHttpClient()],
})
.overrideTemplate(PasswordComponent, '')
.compileComponents();
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
imports: [PasswordComponent],
providers: [FormBuilder, AccountService, provideHttpClient()],
})
);
.overrideTemplate(PasswordComponent, '')
.compileComponents();
}));

beforeEach(() => {
fixture = TestBed.createComponent(PasswordComponent);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ export default class PasswordComponent implements OnInit {
this.doNotMatch.set(true);
} else {
this.passwordService.save(newPassword, currentPassword).subscribe({
next: () => (this.success.set(true)),
error: () => (this.error.set(true)),
next: () => this.success.set(true),
error: () => this.error.set(true),
});
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ describe('Password Service', () => {
// WHEN
service.save(password2, password1).subscribe();

const testRequest = httpMock.expectOne({ method: 'POST', url: applicationConfigService.getEndpointFor('api/account/change-password') });
const testRequest = httpMock.expectOne({
method: 'POST',
url: applicationConfigService.getEndpointFor('api/account/change-password'),
});

// THEN
expect(testRequest.request.body).toEqual({ currentPassword: password1, newPassword: password2 });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,16 +90,14 @@ describe('RegisterComponent', () => {
expect(comp.errorUserExists()).toBe(false);
expect(comp.errorEmailExists()).toBe(false);
expect(comp.error()).toBe(false);
})
}),
));

it('should notify of user existence upon 400/login already in use', inject(
[RegisterService],
fakeAsync((service: RegisterService) => {
const err = { status: 400, error: { type: LOGIN_ALREADY_USED_TYPE } };
jest.spyOn(service, 'save').mockReturnValue(
throwError(() => err)
);
jest.spyOn(service, 'save').mockReturnValue(throwError(() => err));
comp.registerForm.patchValue({
password: 'password',
confirmPassword: 'password',
Expand All @@ -111,16 +109,14 @@ describe('RegisterComponent', () => {
expect(comp.errorUserExists()).toBe(true);
expect(comp.errorEmailExists()).toBe(false);
expect(comp.error()).toBe(false);
})
}),
));

it('should notify of email existence upon 400/email address already in use', inject(
[RegisterService],
fakeAsync((service: RegisterService) => {
const err = { status: 400, error: { type: EMAIL_ALREADY_USED_TYPE } };
jest.spyOn(service, 'save').mockReturnValue(
throwError(() => err)
);
jest.spyOn(service, 'save').mockReturnValue(throwError(() => err));
comp.registerForm.patchValue({
password: 'password',
confirmPassword: 'password',
Expand All @@ -132,16 +128,14 @@ describe('RegisterComponent', () => {
expect(comp.errorEmailExists()).toBe(true);
expect(comp.errorUserExists()).toBe(false);
expect(comp.error()).toBe(false);
})
}),
));

it('should notify of generic error', inject(
[RegisterService],
fakeAsync((service: RegisterService) => {
const err = { status: 503 };
jest.spyOn(service, 'save').mockReturnValue(
throwError(() => err)
);
jest.spyOn(service, 'save').mockReturnValue(throwError(() => err));
comp.registerForm.patchValue({
password: 'password',
confirmPassword: 'password',
Expand All @@ -153,6 +147,6 @@ describe('RegisterComponent', () => {
expect(comp.errorUserExists()).toBe(false);
expect(comp.errorEmailExists()).toBe(false);
expect(comp.error()).toBe(true);
})
}),
));
});
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,10 @@
limitations under the License.
-%>
export class Registration {
constructor(public login: string, public email: string, public password: string, public langKey: string) {}
constructor(
public login: string,
public email: string,
public password: string,
public langKey: string,
) {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ export class Session {
public series: string,
public tokenDate: Date,
public ipAddress: string,
public userAgent: string
public userAgent: string,
) {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ describe('SessionsComponent', () => {
expect(comp.error).toBe(false);
expect(comp.account).toEqual(account);
expect(comp.sessions).toEqual(sessions);
})
}),
));

it('should call delete on Sessions to invalidate a session', inject(
Expand All @@ -84,7 +84,7 @@ describe('SessionsComponent', () => {
tick();

expect(service.delete).toHaveBeenCalledWith('xyz');
})
}),
));

it('should call delete on Sessions and notify of error', inject(
Expand All @@ -100,7 +100,7 @@ describe('SessionsComponent', () => {

expect(comp.success).toBe(false);
expect(comp.error).toBe(true);
})
}),
));

it('should call notify of success upon session invalidation', inject(
Expand All @@ -116,6 +116,6 @@ describe('SessionsComponent', () => {

expect(comp.error).toBe(false);
expect(comp.success).toBe(true);
})
}),
));
});
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ export default class SessionsComponent implements OnInit {
private accountService = inject(AccountService);

ngOnInit(): void {
this.sessionsService.findAll().subscribe(sessions => this.sessions = sessions);
this.sessionsService.findAll().subscribe(sessions => (this.sessions = sessions));

this.accountService.identity().subscribe(account => this.account = account);
this.accountService.identity().subscribe(account => (this.account = account));
}

invalidate(series: string): void {
Expand All @@ -52,9 +52,9 @@ export default class SessionsComponent implements OnInit {
this.sessionsService.delete(encodeURIComponent(series)).subscribe(
() => {
this.success = true;
this.sessionsService.findAll().subscribe(sessions => this.sessions = sessions);
this.sessionsService.findAll().subscribe(sessions => (this.sessions = sessions));
},
() => this.error = true
() => (this.error = true),
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,14 @@ describe('ConfigurationComponent', () => {
let fixture: ComponentFixture<ConfigurationComponent>;
let service: ConfigurationService;

beforeEach(
waitForAsync(() => {
TestBed.configureTestingModule({
imports: [ConfigurationComponent],
providers: [provideHttpClient(), ConfigurationService],
})
.overrideTemplate(ConfigurationComponent, '')
.compileComponents();
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
imports: [ConfigurationComponent],
providers: [provideHttpClient(), ConfigurationService],
})
);
.overrideTemplate(ConfigurationComponent, '')
.compileComponents();
}));

beforeEach(() => {
fixture = TestBed.createComponent(ConfigurationComponent);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ export class ConfigurationService {
Object.values(
Object.values(configProps.contexts)
.map(context => context.beans)
.reduce((allBeans: Beans, contextBeans: Beans) => ({ ...allBeans, ...contextBeans }), {})
)
)
.reduce((allBeans: Beans, contextBeans: Beans) => ({ ...allBeans, ...contextBeans }), {}),
),
),
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,13 @@
See the License for the specific language governing permissions and
limitations under the License.
-%>
<iframe src="swagger-ui/index.html" width="100%" height="900" seamless target="_top" title="Swagger UI" class="border-0" data-cy="swagger-frame"></iframe>
<iframe
src="swagger-ui/index.html"
width="100%"
height="900"
seamless
target="_top"
title="Swagger UI"
class="border-0"
data-cy="swagger-frame"
></iframe>
Loading
Loading