Skip to content

Commit

Permalink
fix: correct ui test config and import translations
Browse files Browse the repository at this point in the history
  • Loading branch information
HenryT-CG committed Jan 9, 2024
1 parent 82d6fd8 commit 3505031
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 21 deletions.
4 changes: 3 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
"node_modules/**",
"src/app/generated/**",
"src/app/api/*",
"src/app/model/*"
"src/app/model/*",
"src/**/*.ico",
"src/**/*.svg"
],
"overrides": [
{
Expand Down
14 changes: 2 additions & 12 deletions karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ module.exports = function (config) {
require('karma-coverage'),
require('karma-jasmine'),
require('karma-jasmine-html-reporter'),
require('karma-junit-reporter'),
require('karma-sonarqube-unit-reporter'),
require('@angular-devkit/build-angular/plugins/karma')
],
Expand All @@ -27,15 +26,6 @@ module.exports = function (config) {
jasmineHtmlReporter: {
suppressAll: true // removes the duplicated traces
},
junitReporter: {
outputDir: 'reports/unit-test-results', // results will be saved as $outputDir/$browserName.xml
outputFile: 'results-junit-tests.xml', // if included, results will be saved as $outputDir/$browserName/$outputFile
suite: 'models', // suite will become the package name attribute in xml testsuite element
useBrowserName: false, // add browser name to report and classes names
nameFormatter: undefined, // function (browser, result) to customize the name attribute in xml testcase element
classNameFormatter: undefined, // function (browser, result) to customize the classname attribute in xml testcase element
properties: {} // key value pair of properties to add to the <properties> section of the report
},
sonarqubeReporter: {
basePath: 'src/app', // test files folder
filePattern: '**/*.spec.ts', // test files glob pattern
Expand All @@ -55,9 +45,9 @@ module.exports = function (config) {
includeAllSources: true,
dir: 'reports',
subdir: 'coverage',
reporters: [{ type: 'html' }, { type: 'text-summary' }, { type: 'lcov' }]
reporters: [{ type: 'html' }, { type: 'text-summary' }]
},
reporters: ['progress', 'kjhtml', 'coverage', 'sonarqubeUnit', 'junit'],
reporters: ['progress', 'kjhtml', 'coverage', 'sonarqubeUnit'],
preprocessors: { 'src/**/*.js': ['coverage'] },
port: 9876,
colors: true,
Expand Down
11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
{
"name": "onecx-theme-ui",
"private": true,
"version": "0.0.0",
"license": "Apache-2.0",
"contributors": [
"OneCX Development Team <[email protected]>"
],
"config": {
"openapiYaml": "src/assets/api/themes-bff-api.yaml",
"openapiOutput": "src/app/generated"
Expand All @@ -13,7 +17,7 @@
"start": "ng serve --configuration=development --proxy-config=proxy.conf.js",
"prepare": "husky install",
"lint": "ng lint",
"eslint": "eslint --ext .js,.ts src",
"eslint": "eslint --quiet --ext .js,.ts src/**",
"format": "ng lint --fix",
"browsers": "npx browserslist",
"test": "ng test",
Expand All @@ -25,7 +29,6 @@
"apigen-generate": "openapi-generator-cli generate -i $npm_package_config_openapiYaml -g typescript-angular -c apigen.yaml -o $npm_package_config_openapiOutput --type-mappings=AnyType=object,set=Array",
"apigen": "npm run apigen-cleanup && npm run apigen-generate && npm run apigen-format"
},
"private": true,
"husky": {
"hooks": {
"pre-commit": "pretty-quick --staged"
Expand All @@ -39,9 +42,7 @@
"tsConfig": "tsconfig.spec.json",
"karmaConfig": "karma.conf.js",
"codeCoverageExclude": [
"src/app/generated/**/*",
"src/app/**/*.spec.ts",
"src/app/test/**/*"
"src/app/generated/**/*"
]
}
},
Expand Down
4 changes: 3 additions & 1 deletion src/app/shared/shared.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ export const basePathProvider = (mfeInfo: MfeInfo) => {
}

export function HttpLoaderFactory(http: HttpClient, mfeInfo: MfeInfo) {
console.log(`Configuring translation loader ${mfeInfo?.remoteBaseUrl}`)
if (mfeInfo) {
console.log(`Configuring translation loader ${mfeInfo?.remoteBaseUrl}`)
}
// if running standalone then load the app assets directly from remote base URL
const appAssetPrefix = mfeInfo && mfeInfo.remoteBaseUrl ? mfeInfo.remoteBaseUrl : './'
return new TranslateCombinedLoader(
Expand Down
4 changes: 2 additions & 2 deletions src/app/theme/theme-import/theme-import.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,14 @@ export class ThemeImportComponent implements OnInit {
})
.subscribe({
next: (data) => {
this.msgService.success({ summaryKey: 'PORTAL_IMPORT.IMPORT_THEME_SUCCESS' })
this.msgService.success({ summaryKey: 'THEME.IMPORT.IMPORT_THEME_SUCCESS' })
this.onImportThemeClear()
this.displayThemeImport = false
this.uploadEmitter.emit()
this.router.navigate([`./${data.id}`], { relativeTo: this.route })
},
error: () => {
this.msgService.error({ summaryKey: 'PORTAL_IMPORT.IMPORT_THEME_FAIL' })
this.msgService.error({ summaryKey: 'THEME.IMPORT.IMPORT_THEME_FAIL' })
}
})
}
Expand Down

0 comments on commit 3505031

Please sign in to comment.