Skip to content

Commit

Permalink
fix: initial test setup for search
Browse files Browse the repository at this point in the history
  • Loading branch information
HenryT-CG committed Jan 10, 2024
1 parent d649f2f commit f3c80f3
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 36 deletions.
4 changes: 2 additions & 2 deletions src/app/app.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ describe('AppComponent', () => {
expect(app).toBeTruthy()
})

it(`should have as title 'theme-mgmt'`, () => {
it(`should have as title 'product-store-ui'`, () => {
const fixture = TestBed.createComponent(AppComponent)
const app = fixture.componentInstance
expect(app.title).toEqual('theme-mgmt')
expect(app.title).toEqual('product-store-ui')
})
})
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
/* tslint:disable:no-unused-variable */
import { NO_ERRORS_SCHEMA } from '@angular/core'
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'
import { HttpClient } from '@angular/common/http'
import { HttpClientTestingModule } from '@angular/common/http/testing'
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'
import { ActivatedRoute } from '@angular/router'
import { TranslateLoader, TranslateModule } from '@ngx-translate/core'
import { HttpLoaderFactory } from 'src/app/app.module'

import { PortalMessageService } from '@onecx/portal-integration-angular'
import { HttpLoaderFactory } from 'src/app/shared/shared.module'
import { ProductSearchComponent } from './product-search.component'

describe('ProductSearchComponent', () => {
let component: ProductSearchComponent
let fixture: ComponentFixture<ProductSearchComponent>

const msgServiceSpy = jasmine.createSpyObj<PortalMessageService>('PortalMessageService', ['success', 'error', 'info'])

beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [ProductSearchComponent],
Expand All @@ -24,18 +27,8 @@ describe('ProductSearchComponent', () => {
}
})
],
providers: [
{
provide: ActivatedRoute,
useValue: {
snapshot: {
paramMap: {
get: () => '1'
}
}
}
}
]
schemas: [NO_ERRORS_SCHEMA],
providers: [{ provide: PortalMessageService, useValue: msgServiceSpy }]
}).compileComponents()
}))

Expand All @@ -45,6 +38,12 @@ describe('ProductSearchComponent', () => {
fixture.detectChanges()
})

afterEach(() => {
msgServiceSpy.success.calls.reset()
msgServiceSpy.error.calls.reset()
msgServiceSpy.info.calls.reset()
})

it('should create', () => {
expect(component).toBeTruthy()
})
Expand Down
14 changes: 1 addition & 13 deletions src/assets/env.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,7 @@
"KEYCLOAK_URL": "${KEYCLOAK_URL}",
"KEYCLOAK_CLIENT_ID": "${KEYCLOAK_CLIENT_ID}",
"KEYCLOAK_ENABLE_SILENT_SSO": "true",
"ONECX_PORTAL_FAVORITES_DISABLED": "${ONECX_PORTAL_FAVORITES_DISABLED}",
"ONECX_PORTAL_FEEDBACK_DISABLED": "${ONECX_PORTAL_FEEDBACK_DISABLED}",
"ONECX_PORTAL_SEARCH_DISABLED": "${ONECX_PORTAL_SEARCH_DISABLED}",
"ONECX_PORTAL_SUPPORT_TICKET_DISABLED": "${ONECX_PORTAL_SUPPORT_TICKET_DISABLED}",
"ONECX_PORTAL_ANNOUNCEMENTS_DISABLED": "${ONECX_PORTAL_ANNOUNCEMENTS_DISABLED}",
"ONECX_PORTAL_PASSWORD_CHANGE_DISABLED": "${ONECX_PORTAL_PASSWORD_CHANGE_DISABLED}",
"ONECX_PORTAL_SETTINGS_DISABLED": "${ONECX_PORTAL_SETTINGS_DISABLED}",
"ONECX_PORTAL_MY_ROLES_PERMISSIONS_DISABLED": "${ONECX_PORTAL_MY_ROLES_PERMISSIONS_DISABLED}",
"ONECX_PORTAL_HELP_DISABLED": "${ONECX_PORTAL_HELP_DISABLED}",
"ONECX_PORTAL_START_IN_EDIT_MODE": "${ONECX_PORTAL_START_IN_EDIT_MODE}",
"TOKEN_ROLE_CLAIM_NAME": "${TOKEN_ROLE_CLAIM_NAME}",
"TKIT_PORTAL_ID": "ADMIN",
"TKIT_PORTAL_DEFAULT_THEME": "${TKIT_PORTAL_DEFAULT_THEME}",
"TKIT_PORTAL_THEME_SERVER_URL": "${TKIT_PORTAL_THEME_SERVER_URL}",
"TKIT_PORTAL_ID": "${TKIT_PORTAL_ID}",
"TKIT_SEARCH_BASE_URL": "${TKIT_SEARCH_BASE_URL}"
}
2 changes: 1 addition & 1 deletion src/assets/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
},
"DELETE": {
"LABEL": "Delete",
"TOOLTIP": "Delete theme",
"TOOLTIP": "Delete Product",
"MESSAGE": "Do you want to delete {{ITEM}}?",
"MESSAGE_INFO": "This action cannot be undone!",
"PRODUCT_NOK": "Product could not be deleted",
Expand Down
4 changes: 2 additions & 2 deletions src/environments/environment.prod.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export const environment = {
production: true,
BASE_PATH: '/portal-api',
apiPrefix: 'portal-api'
BASE_PATH: '/product-store-bff',
apiPrefix: 'product-store-bff'
}
2 changes: 1 addition & 1 deletion src/environments/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export const environment = {
KEYCLOAK_URL: 'http://keycloak-app/',
KEYCLOAK_REALM: 'OneCX',
skipRemoteConfigLoad: true,
apiPrefix: 'portal-api'
apiPrefix: 'product-store-bff'
}

/*
Expand Down
1 change: 0 additions & 1 deletion src/test-setup.ts

This file was deleted.

0 comments on commit f3c80f3

Please sign in to comment.