Compare commits
No commits in common. "develop" and "task/popup-for-dynamic-form" have entirely different histories.
develop
...
task/popup
161
Jenkinsfile
vendored
161
Jenkinsfile
vendored
@ -1,161 +0,0 @@
|
||||
pipeline {
|
||||
|
||||
agent none
|
||||
|
||||
options {
|
||||
buildDiscarder(logRotator(numToKeepStr: '10'))
|
||||
disableConcurrentBuilds()
|
||||
}
|
||||
|
||||
stages {
|
||||
|
||||
stage('Build & Test') {
|
||||
|
||||
agent { label getAgentLabel() }
|
||||
|
||||
environment {
|
||||
CHROME_BIN = "${getChromeBin()}"
|
||||
}
|
||||
|
||||
stages {
|
||||
|
||||
stage('Cleanup Workspace') {
|
||||
steps { cleanWs() }
|
||||
}
|
||||
|
||||
stage('Checkout') {
|
||||
steps { checkout scm }
|
||||
}
|
||||
|
||||
stage('Inject Environment File') {
|
||||
when {
|
||||
not {
|
||||
anyOf {
|
||||
branch pattern: "feature/.*", comparator: "REGEXP"
|
||||
branch pattern: "bug/.*", comparator: "REGEXP"
|
||||
}
|
||||
}
|
||||
}
|
||||
steps {
|
||||
configFileProvider([
|
||||
configFile(
|
||||
fileId: getEnvFileId(),
|
||||
targetLocation: 'src/environments/environment.ts',
|
||||
replaceTokens: true
|
||||
)
|
||||
]) {
|
||||
echo "Injected environment for ${env.BRANCH_NAME}"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('Install Dependencies') {
|
||||
steps { sh 'npm ci' }
|
||||
}
|
||||
|
||||
stage('Run Tests') {
|
||||
when {
|
||||
anyOf {
|
||||
branch pattern: "feature/.*", comparator: "REGEXP"
|
||||
branch pattern: "bug/.*", comparator: "REGEXP"
|
||||
branch 'develop'
|
||||
branch 'prod'
|
||||
changeRequest()
|
||||
}
|
||||
}
|
||||
steps {
|
||||
sh 'npm run test -- --watch=false --browsers=ChromeHeadless'
|
||||
}
|
||||
}
|
||||
|
||||
stage('Build Angular App') {
|
||||
when {
|
||||
anyOf {
|
||||
branch 'develop'
|
||||
branch 'prod'
|
||||
changeRequest()
|
||||
}
|
||||
}
|
||||
steps {
|
||||
sh 'ng build --configuration production --base-href /admin/'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('Production Approval') {
|
||||
when { branch 'prod' }
|
||||
steps {
|
||||
input message: 'Approve deployment to PRODUCTION?', ok: 'Deploy'
|
||||
}
|
||||
}
|
||||
|
||||
stage('Deploy & Verify') {
|
||||
|
||||
when {
|
||||
anyOf {
|
||||
branch 'develop'
|
||||
branch 'prod'
|
||||
}
|
||||
}
|
||||
|
||||
agent { label getAgentLabel() }
|
||||
|
||||
stages {
|
||||
|
||||
stage('Deploy') {
|
||||
steps {
|
||||
sh """
|
||||
rsync -av --delete dist/portfolio-admin/browser/ ${getDeployPath()}/
|
||||
sudo /usr/bin/systemctl reload nginx
|
||||
"""
|
||||
}
|
||||
}
|
||||
|
||||
stage('Health Check') {
|
||||
steps {
|
||||
sh """
|
||||
sleep 3
|
||||
curl -f ${getHealthUrl()}
|
||||
"""
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
post {
|
||||
success { echo "Deployment successful for ${env.BRANCH_NAME}" }
|
||||
failure { echo "Deployment failed for ${env.BRANCH_NAME}" }
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// -------- Helper Methods --------
|
||||
//
|
||||
|
||||
def getAgentLabel() {
|
||||
return env.BRANCH_NAME == 'prod' ? 'oracle-prod' : 'built-in'
|
||||
}
|
||||
|
||||
def getEnvFileId() {
|
||||
return env.BRANCH_NAME == 'prod' ? 'admin-prod-properties' : 'admin-uat-properties'
|
||||
}
|
||||
|
||||
def getDeployPath() {
|
||||
return env.BRANCH_NAME == 'prod'
|
||||
? "/var/www/bangararaju.kottedi.in/admin"
|
||||
: "/var/www/bangararaju.kottedi.in/admin"
|
||||
}
|
||||
|
||||
def getHealthUrl() {
|
||||
return env.BRANCH_NAME == 'prod'
|
||||
? "https://bangararaju.kottedi.in/admin"
|
||||
: "https://bangararaju-uat.kottedi.in/admin"
|
||||
}
|
||||
|
||||
def getChromeBin() {
|
||||
return env.BRANCH_NAME == 'prod'
|
||||
? "/snap/bin/chromium"
|
||||
: "/usr/bin/chromium"
|
||||
}
|
||||
@ -79,8 +79,6 @@
|
||||
"test": {
|
||||
"builder": "@angular/build:karma",
|
||||
"options": {
|
||||
"main": "./src/test.ts",
|
||||
"polyfills": [],
|
||||
"tsConfig": "tsconfig.spec.json",
|
||||
"inlineStyleLanguage": "scss",
|
||||
"assets": [
|
||||
|
||||
20
package-lock.json
generated
20
package-lock.json
generated
@ -28,7 +28,6 @@
|
||||
"@angular/build": "^20.3.2",
|
||||
"@angular/cli": "^20.3.2",
|
||||
"@angular/compiler-cli": "^20.3.0",
|
||||
"@angular/platform-browser-dynamic": "^20.3.4",
|
||||
"@types/express": "^5.0.1",
|
||||
"@types/jasmine": "~5.1.0",
|
||||
"@types/node": "^20.17.19",
|
||||
@ -755,25 +754,6 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/@angular/platform-browser-dynamic": {
|
||||
"version": "20.3.4",
|
||||
"resolved": "https://registry.npmjs.org/@angular/platform-browser-dynamic/-/platform-browser-dynamic-20.3.4.tgz",
|
||||
"integrity": "sha512-eeScVJyZLDTNrnEDDBgF/WZpZrjEszFFkuEzNQ43sbPjc5M7Noue38Nd9QZ664ZQ3a4ZpUpritfHvc55a/fl9Q==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"tslib": "^2.3.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^20.19.0 || ^22.12.0 || >=24.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@angular/common": "20.3.4",
|
||||
"@angular/compiler": "20.3.4",
|
||||
"@angular/core": "20.3.4",
|
||||
"@angular/platform-browser": "20.3.4"
|
||||
}
|
||||
},
|
||||
"node_modules/@angular/platform-server": {
|
||||
"version": "20.3.4",
|
||||
"resolved": "https://registry.npmjs.org/@angular/platform-server/-/platform-server-20.3.4.tgz",
|
||||
|
||||
@ -44,7 +44,6 @@
|
||||
"@angular/build": "^20.3.2",
|
||||
"@angular/cli": "^20.3.2",
|
||||
"@angular/compiler-cli": "^20.3.0",
|
||||
"@angular/platform-browser-dynamic": "^20.3.4",
|
||||
"@types/express": "^5.0.1",
|
||||
"@types/jasmine": "~5.1.0",
|
||||
"@types/node": "^20.17.19",
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { provideHttpClientTesting } from '@angular/common/http/testing';
|
||||
|
||||
import { About } from './about';
|
||||
|
||||
@ -9,8 +8,7 @@ describe('About', () => {
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
imports: [About],
|
||||
providers: [provideHttpClientTesting()]
|
||||
imports: [About]
|
||||
})
|
||||
.compileComponents();
|
||||
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { provideHttpClientTesting } from '@angular/common/http/testing';
|
||||
|
||||
import { Contact } from './contact';
|
||||
|
||||
@ -9,8 +8,7 @@ describe('Contact', () => {
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
imports: [Contact],
|
||||
providers: [provideHttpClientTesting()]
|
||||
imports: [Contact]
|
||||
})
|
||||
.compileComponents();
|
||||
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { provideHttpClientTesting } from '@angular/common/http/testing';
|
||||
|
||||
import { Projects } from './projects';
|
||||
|
||||
@ -9,8 +8,7 @@ describe('Projects', () => {
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
imports: [Projects],
|
||||
providers: [provideHttpClientTesting()]
|
||||
imports: [Projects]
|
||||
})
|
||||
.compileComponents();
|
||||
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { provideHttpClientTesting } from '@angular/common/http/testing';
|
||||
|
||||
import { Resume } from './resume';
|
||||
|
||||
@ -9,8 +8,7 @@ describe('Resume', () => {
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
imports: [Resume],
|
||||
providers: [provideHttpClientTesting()]
|
||||
imports: [Resume]
|
||||
})
|
||||
.compileComponents();
|
||||
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { provideHttpClientTesting } from '@angular/common/http/testing';
|
||||
|
||||
import { AdminService } from './admin.service';
|
||||
|
||||
@ -7,9 +6,7 @@ describe('AdminService', () => {
|
||||
let service: AdminService;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
providers: [provideHttpClientTesting()]
|
||||
});
|
||||
TestBed.configureTestingModule({});
|
||||
service = TestBed.inject(AdminService);
|
||||
});
|
||||
|
||||
|
||||
@ -15,5 +15,11 @@ describe('App', () => {
|
||||
const app = fixture.componentInstance;
|
||||
expect(app).toBeTruthy();
|
||||
});
|
||||
// title rendering test removed — template doesn't render a static H1
|
||||
|
||||
it('should render title', () => {
|
||||
const fixture = TestBed.createComponent(App);
|
||||
fixture.detectChanges();
|
||||
const compiled = fixture.nativeElement as HTMLElement;
|
||||
expect(compiled.querySelector('h1')?.textContent).toContain('Hello, portfolio-admin');
|
||||
});
|
||||
});
|
||||
|
||||
@ -1,16 +1,12 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { provideHttpClientTesting } from '@angular/common/http/testing';
|
||||
import { provideRouter } from '@angular/router';
|
||||
|
||||
import { AuthService } from './auth.service';
|
||||
|
||||
describe('AuthService', () => {
|
||||
let service: AuthService;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
providers: [provideRouter([]), provideHttpClientTesting(), AuthService]
|
||||
}).compileComponents();
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({});
|
||||
service = TestBed.inject(AuthService);
|
||||
});
|
||||
|
||||
|
||||
@ -1,6 +1,4 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { provideHttpClientTesting } from '@angular/common/http/testing';
|
||||
import { provideRouter } from '@angular/router';
|
||||
|
||||
import { AuthService} from './auth.service';
|
||||
|
||||
@ -8,9 +6,7 @@ describe('AuthService', () => {
|
||||
let service: AuthService;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
providers: [provideRouter([]), provideHttpClientTesting()]
|
||||
});
|
||||
TestBed.configureTestingModule({});
|
||||
service = TestBed.inject(AuthService);
|
||||
});
|
||||
|
||||
|
||||
@ -1,6 +1,4 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { provideHttpClientTesting } from '@angular/common/http/testing';
|
||||
import { provideRouter } from '@angular/router';
|
||||
|
||||
import { OtpComponent } from './otp.component';
|
||||
|
||||
@ -10,8 +8,7 @@ describe('OtpComponent', () => {
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
imports: [OtpComponent],
|
||||
providers: [provideRouter([]), provideHttpClientTesting()]
|
||||
imports: [OtpComponent]
|
||||
})
|
||||
.compileComponents();
|
||||
|
||||
|
||||
@ -1,29 +1,16 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { of } from 'rxjs';
|
||||
import { HttpInterceptorFn } from '@angular/common/http';
|
||||
|
||||
import { AuthInterceptor } from './auth-interceptor';
|
||||
import { AuthService } from '../auth/auth.service';
|
||||
|
||||
describe('AuthInterceptor', () => {
|
||||
const mockAuthService: Partial<AuthService> = {
|
||||
getApiKey: () => '',
|
||||
currentToken: null as unknown as string | null,
|
||||
refreshToken: () => of({ accessToken: 'new-token' }),
|
||||
safeSetToken: () => { /* no-op for testing */ },
|
||||
logout: () => { /* no-op for testing */ }
|
||||
};
|
||||
|
||||
const interceptor: HttpInterceptorFn = (req, next) =>
|
||||
TestBed.runInInjectionContext(() => AuthInterceptor(req, next));
|
||||
|
||||
beforeEach(() => TestBed.configureTestingModule({
|
||||
providers: [
|
||||
{ provide: AuthService, useValue: mockAuthService }
|
||||
AuthInterceptor
|
||||
]
|
||||
}));
|
||||
|
||||
it('should be created', () => {
|
||||
const interceptor: AuthInterceptor = TestBed.inject(AuthInterceptor);
|
||||
expect(interceptor).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
||||
@ -1,6 +1,4 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { provideHttpClientTesting } from '@angular/common/http/testing';
|
||||
import { provideRouter } from '@angular/router';
|
||||
|
||||
import { AdminLayout } from './admin-layout';
|
||||
|
||||
@ -10,8 +8,7 @@ describe('AdminLayout', () => {
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
imports: [AdminLayout],
|
||||
providers: [provideRouter([]), provideHttpClientTesting()]
|
||||
imports: [AdminLayout]
|
||||
})
|
||||
.compileComponents();
|
||||
|
||||
|
||||
@ -1,21 +1,19 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { DynamicFormComponent } from './dynamic-form';
|
||||
import { DynamicFormConfig } from './dynamic-form-config';
|
||||
import { DynamicForm } from './dynamic-form';
|
||||
|
||||
describe('DynamicForm', () => {
|
||||
let component: DynamicFormComponent;
|
||||
let fixture: ComponentFixture<DynamicFormComponent>;
|
||||
let component: DynamicForm;
|
||||
let fixture: ComponentFixture<DynamicForm>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
imports: [DynamicFormComponent]
|
||||
imports: [DynamicForm]
|
||||
})
|
||||
.compileComponents();
|
||||
|
||||
fixture = TestBed.createComponent(DynamicFormComponent);
|
||||
fixture = TestBed.createComponent(DynamicForm);
|
||||
component = fixture.componentInstance;
|
||||
component.config = { fields: [] } as unknown as DynamicFormConfig;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
|
||||
@ -1,8 +1,6 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { provideHttpClientTesting } from '@angular/common/http/testing';
|
||||
|
||||
import { DynamicPopupComponent } from './dynamic-popup';
|
||||
import { DynamicFormConfig } from '../dynamic-form/dynamic-form-config';
|
||||
|
||||
describe('DynamicPopupComponent', () => {
|
||||
let component: DynamicPopupComponent;
|
||||
@ -10,15 +8,12 @@ describe('DynamicPopupComponent', () => {
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
imports: [DynamicPopupComponent],
|
||||
providers: [provideHttpClientTesting()]
|
||||
imports: [DynamicPopupComponent]
|
||||
})
|
||||
.compileComponents();
|
||||
|
||||
fixture = TestBed.createComponent(DynamicPopupComponent);
|
||||
component = fixture.componentInstance;
|
||||
component.config = { title: 'Test', submitLabel: 'Save', fields: [] } as DynamicFormConfig;
|
||||
component.data = {};
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
|
||||
19
src/test.ts
19
src/test.ts
@ -1,19 +0,0 @@
|
||||
// Test bootstrap for Karma
|
||||
import { provideZonelessChangeDetection } from '@angular/core';
|
||||
import { getTestBed, TestBed } from '@angular/core/testing';
|
||||
import { BrowserTestingModule, platformBrowserTesting } from '@angular/platform-browser/testing';
|
||||
import { provideHttpClient } from '@angular/common/http';
|
||||
import { provideHttpClientTesting } from '@angular/common/http/testing';
|
||||
|
||||
declare const beforeEach: (fn: () => void) => void;
|
||||
|
||||
getTestBed().initTestEnvironment(
|
||||
BrowserTestingModule,
|
||||
platformBrowserTesting()
|
||||
);
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
providers: [provideZonelessChangeDetection(), provideHttpClient(), provideHttpClientTesting()]
|
||||
});
|
||||
});
|
||||
Loading…
Reference in New Issue
Block a user