-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into feature/MARP-1058-Market-website-Remove-u…
…sing-of-Images-Url-from-github-in-Product-Detail
- Loading branch information
Showing
29 changed files
with
561 additions
and
112 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
27 changes: 27 additions & 0 deletions
27
...etplace-service/src/main/java/com/axonivy/market/exceptions/model/NoContentException.java
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 @@ | ||
package com.axonivy.market.exceptions.model; | ||
|
||
import com.axonivy.market.enums.ErrorCode; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.Setter; | ||
|
||
import java.io.Serial; | ||
|
||
@Getter | ||
@Setter | ||
@AllArgsConstructor | ||
public class NoContentException extends RuntimeException { | ||
|
||
@Serial | ||
private static final long serialVersionUID = 1L; | ||
private static final String SEPARATOR = "-"; | ||
|
||
private final String code; | ||
private final String message; | ||
|
||
public NoContentException(ErrorCode errorCode, String additionalMessage) { | ||
this.code = errorCode.getCode(); | ||
this.message = errorCode.getHelpText() + SEPARATOR + additionalMessage; | ||
} | ||
|
||
} |
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
66 changes: 66 additions & 0 deletions
66
marketplace-ui/src/app/core/interceptors/api.interceptor.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,66 @@ | ||
import { HttpClient, HttpHeaders, provideHttpClient, withInterceptors } from '@angular/common/http'; | ||
import { HttpTestingController } from '@angular/common/http/testing'; | ||
import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
import { ActivatedRoute } from '@angular/router'; | ||
import { TranslateModule } from '@ngx-translate/core'; | ||
import { of } from 'rxjs'; | ||
import { ProductComponent } from '../../modules/product/product.component'; | ||
import { DESIGNER_COOKIE_VARIABLE } from '../../shared/constants/common.constant'; | ||
import { apiInterceptor } from './api.interceptor'; | ||
|
||
describe('AuthInterceptor', () => { | ||
let productComponent: ProductComponent; | ||
let fixture: ComponentFixture<ProductComponent>; | ||
let httpClient: HttpClient; | ||
let httpTestingController: HttpTestingController; | ||
|
||
beforeEach(() => { | ||
TestBed.configureTestingModule({ | ||
imports: [ProductComponent, TranslateModule.forRoot()], | ||
providers: [ | ||
provideHttpClient(withInterceptors([apiInterceptor])), | ||
HttpTestingController, | ||
{ | ||
provide: ActivatedRoute, | ||
useValue: { | ||
queryParams: of({ | ||
[DESIGNER_COOKIE_VARIABLE.restClientParamName]: true | ||
}) | ||
} | ||
} | ||
] | ||
}); | ||
|
||
httpClient = TestBed.inject(HttpClient); | ||
httpTestingController = TestBed.inject(HttpTestingController); | ||
|
||
fixture = TestBed.createComponent(ProductComponent); | ||
productComponent = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should throw error', () => { | ||
const headers = new HttpHeaders({ | ||
'X-Requested-By': 'ivy' | ||
}); | ||
httpClient.get('product', { headers }).subscribe({ | ||
next() { | ||
fail('Expected an error, but got a response'); | ||
}, | ||
error(e) { | ||
expect(e.status).not.toBe(200); | ||
} | ||
}); | ||
}); | ||
|
||
it('should throw error with the url contains i18n', () => { | ||
httpClient.get('assets/i18n').subscribe({ | ||
next() { | ||
fail('Expected an error, but got a response'); | ||
}, | ||
error(e) { | ||
expect(e.status).not.toBe(200); | ||
} | ||
}); | ||
}); | ||
}); |
Oops, something went wrong.