From 3e3a98e52270615bdb43ee236cd72eb0a7b648d2 Mon Sep 17 00:00:00 2001 From: argirok Date: Wed, 8 May 2024 12:08:21 +0300 Subject: [PATCH] [pluginsFunctionality | DONE | ADDED] add a test file app.component.spec.ts checking about piwik, run tests on build --- angular.json | 2 +- package.json | 6 +++--- src/app/app.component.spec.ts | 19 +++++++++++++++++++ 3 files changed, 23 insertions(+), 4 deletions(-) create mode 100644 src/app/app.component.spec.ts diff --git a/angular.json b/angular.json index 4f72345..b1b21c5 100644 --- a/angular.json +++ b/angular.json @@ -197,7 +197,7 @@ "tsConfig": "src/tsconfig.spec.json", "karmaConfig": "src/karma.conf.js", "styles": [ - "src/styles.css" + "src/styles.less" ], "scripts": [], "assets": [ diff --git a/package.json b/package.json index 3e8abc1..e47956a 100644 --- a/package.json +++ b/package.json @@ -5,9 +5,9 @@ "ng": "ng", "start": "ng serve --disable-host-check --host 0.0.0.0 --port 4200", "build": "ng build", - "build-dev": "ng build --configuration=development", - "build-beta": "ng build --configuration=beta", - "build-prod": "ng build --configuration production", + "build-dev": "ng build --configuration=development && ng test --watch=false", + "build-beta": "ng build --configuration=beta && ng test --watch=false", + "build-prod": "ng build --configuration production && ng test --watch=false", "webpack-bundle-analyzer": "ng build --stats-json && webpack-bundle-analyzer dist/connect/browser/stats.json --host 0.0.0.0", "test": "ng test", "e2e": "ng e2e", diff --git a/src/app/app.component.spec.ts b/src/app/app.component.spec.ts new file mode 100644 index 0000000..3c72288 --- /dev/null +++ b/src/app/app.component.spec.ts @@ -0,0 +1,19 @@ +import {TestBed } from '@angular/core/testing'; +import {properties} from "../environments/environment"; + +describe('Environment Configuration', () => { + beforeEach(() => { + TestBed.configureTestingModule({ + }); + }); + + it('should have correct setting for piwik tracking based on environment', () => { + if (properties.environment == "beta" || properties.environment == "production") { + expect(properties.enablePiwikTrack).toBe(true,`Piwik tracking: Expected enablePiwikTrack to be true but it is ${properties.enablePiwikTrack}`); + } else { + expect(properties.enablePiwikTrack).toBe(false, `Piwik tracking: Expected enablePiwikTrack to be false but it is ${properties.enablePiwikTrack}`); + } + }); + + // Add more tests for other properties as needed +});