Skip to content

Commit c6fede5

Browse files
author
Andrea Barbasso
committed
[DSC-2635] fix tests build
1 parent d139334 commit c6fede5

22 files changed

Lines changed: 234 additions & 88 deletions

File tree

src/app/core/auth/auth.effects.spec.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,6 @@ describe('AuthEffects', () => {
210210
const expected = cold('--b-', { b: new CheckAuthenticationTokenCookieAction() });
211211

212212
expect(authEffects.authenticated$).toBeObservable(expected);
213-
done();
214213
});
215214
});
216215
});

src/app/core/browse/search-manager.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,12 +145,12 @@ export class SearchManager {
145145
if (item.entityType === followMetadata.type) {
146146
if (isArray(followMetadata.metadata)) {
147147
followMetadata.metadata.forEach((metadata) => {
148-
Metadata.all(item.metadata, metadata, null, environment.followAuthorityMetadataValuesLimit)
148+
Metadata.all(item.metadata, metadata, null, undefined, undefined, environment.followAuthorityMetadataValuesLimit)
149149
.filter((metadataValue: MetadataValue) => Metadata.hasValidItemAuthority(metadataValue.authority))
150150
.forEach((metadataValue: MetadataValue) => uuidMap[metadataValue.authority] = metadataValue);
151151
});
152152
} else {
153-
Metadata.all(item.metadata, followMetadata.metadata, null, environment.followAuthorityMetadataValuesLimit)
153+
Metadata.all(item.metadata, followMetadata.metadata, null, undefined, undefined, environment.followAuthorityMetadataValuesLimit)
154154
.filter((metadataValue: MetadataValue) => Metadata.hasValidItemAuthority(metadataValue.authority))
155155
.forEach((metadataValue: MetadataValue) => uuidMap[metadataValue.authority] = metadataValue);
156156
}

src/app/core/data/item-data.service.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ import {
3131
} from '../../shared/empty.util';
3232
import { NotificationsService } from '../../shared/notifications/notifications.service';
3333
import { PaginatedSearchOptions } from '../../shared/search/models/paginated-search-options.model';
34-
import { FollowLinkConfig } from '../../shared/utils/follow-link-config.model';
3534
import { BrowseService } from '../browse/browse.service';
3635
import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service';
3736
import { RequestParam } from '../cache/models/request-param.model';

src/app/core/locale/locale.service.spec.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,10 +171,11 @@ describe('LocaleService test suite', () => {
171171
testScheduler.run(({ expectObservable }) => {
172172
expectObservable(service.getLanguageCodeList()).toBe('(a|)', { a: ['fr;q=0.5', 'en-US;q=1', 'en;q=0.9'] });
173173
});
174-
});
175-
});
176174
});
177175

176+
});
177+
178+
178179
describe('getLanguageCodeFromCookie', () => {
179180
it('should return language from cookie', () => {
180181
spyOnGet.and.returnValue('de');

src/app/core/metadata/head-tag.service.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -855,7 +855,7 @@ export class HeadTagService {
855855

856856
private setGenericPageMetaTags() {
857857
const pageDocumentTitle = this._document.getElementsByTagName('title')[0].innerText;
858-
const pageUrl = new URLCombiner(this.hardRedirectService.getCurrentOrigin(), this.router.url).toString();
858+
const pageUrl = new URLCombiner(this.hardRedirectService.getBaseUrl(), this.router.url).toString();
859859
const genericPageOpenGraphType = 'website';
860860

861861
this.setTitleTags(pageDocumentTitle);
@@ -871,6 +871,6 @@ export class HeadTagService {
871871
}
872872

873873
private getUrlOrigin(): string {
874-
return isPlatformBrowser(this.platformId) ? this.hardRedirectService.getCurrentOrigin() : this.origin;
874+
return isPlatformBrowser(this.platformId) ? this.hardRedirectService.getBaseUrl() : this.origin;
875875
}
876876
}

src/app/core/shared/dspace-object.model.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ export class DSpaceObject extends ListableObject implements CacheableObject {
135135
* @returns {MetadataValue[]} the matching values or an empty array.
136136
*/
137137
limitedMetadata(keyOrKeys: string | string[], limit: number, valueFilter?: MetadataValueFilter): MetadataValue[] {
138-
return Metadata.all(this.metadata, keyOrKeys, valueFilter, limit);
138+
return Metadata.all(this.metadata, keyOrKeys, undefined, valueFilter, undefined, limit);
139139
}
140140

141141
/**

src/app/core/shared/metadata.utils.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ describe('Metadata', () => {
183183

184184
describe('hasValue method', () => {
185185
const testHasValue = (value, expected) =>
186-
testMethod(Metadata.hasValue, 'boolean', value, null, expected);
186+
testMethod(Metadata.hasValue, 'boolean', value, null, undefined, expected);
187187

188188
describe('with undefined value', () => {
189189
testHasValue(undefined, false);

src/app/core/shared/metadata.utils.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,10 @@ export class Metadata {
7575
return matches;
7676
}
7777
}
78-
for (const mdKey of Metadata.resolveKeys(metadata, keyOrKeys)) {
79-
if (metadata[mdKey]) {
80-
for (const candidate of metadata[mdKey]) {
78+
for (const mdMap of mdMaps) {
79+
for (const mdKey of Metadata.resolveKeys(mdMap, keyOrKeys)) {
80+
if (mdMap[mdKey]) {
81+
for (const candidate of mdMap[mdKey]) {
8182
if (Metadata.valueMatches(candidate as MetadataValue, filter)) {
8283
if (escapeHTML) {
8384
matches.push(Object.assign(new MetadataValue(), candidate, {
@@ -87,6 +88,7 @@ export class Metadata {
8788
matches.push(candidate as MetadataValue);
8889
}
8990
}
91+
}
9092
}
9193
}
9294
}

src/app/cris-layout/pipes/ds-date.pipe.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export class DsDatePipe implements PipeTransform, OnDestroy {
3030
}
3131

3232
transform(value: string, ...params: any[]): string {
33-
const locale = this.localeService.getCurrentLanguageCode();
33+
const locale = this.asyncPipe.transform(this.localeService.getCurrentLanguageCode());
3434
return isValidDate(value) ? localeDate(value, locale) : value;
3535
}
3636

src/app/footer/footer.component.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@ import {
1515
Observable,
1616
of as observableOf,
1717
} from 'rxjs';
18-
import { take } from 'rxjs/operators';
18+
import {
19+
take,
20+
withLatestFrom,
21+
} from 'rxjs/operators';
1922

2023
import {
2124
APP_CONFIG,
@@ -91,10 +94,13 @@ export class FooterComponent implements OnInit {
9194
style: '',
9295
};
9396
this.site = this.siteService.find().pipe(take(1));
94-
this.siteService.find().pipe(take(1)).subscribe(
95-
(site: Site) => {
97+
this.siteService.find().pipe(
98+
take(1),
99+
withLatestFrom(this.locale.getCurrentLanguageCode()),
100+
).subscribe(
101+
([site, langCode]: [Site, string]) => {
96102
this.hasSiteFooterSections = !isEmpty(site?.firstMetadataValue('cris.cms.footer',
97-
{ language: this.locale.getCurrentLanguageCode() }));
103+
{ language: langCode }));
98104
},
99105
);
100106
}

0 commit comments

Comments
 (0)