[pluginsFunctionality | DONE | ADDED] add a test file app.component.spec.ts checking about piwik, run tests on build

This commit is contained in:
argirok 2024-05-08 12:08:21 +03:00
parent e0242ddace
commit 3e3a98e522
3 changed files with 23 additions and 4 deletions

View File

@ -197,7 +197,7 @@
"tsConfig": "src/tsconfig.spec.json",
"karmaConfig": "src/karma.conf.js",
"styles": [
"src/styles.css"
"src/styles.less"
],
"scripts": [],
"assets": [

View File

@ -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",

View File

@ -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
});