Skip to content

Commit

Permalink
[ACS-8634] Change saved searches config file name (#10370)
Browse files Browse the repository at this point in the history
  • Loading branch information
MichalKinas authored Nov 8, 2024
1 parent 3aabb94 commit 3ec3e73
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion docs/core/services/saved-searches.service.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ When the saved searches file does not exist, it will be created:

```typescript
this.savedSearchService.createSavedSearchesNode('parent-node-id').subscribe((node) => {
console.log('Created saved-searches.json node:', node);
console.log('Created config.json node:', node);
});
```

Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ describe('SavedSearchesService', () => {
localStorage.removeItem(SAVED_SEARCHES_NODE_ID + testUserName);
});

it('should retrieve saved searches from the saved-searches.json file', (done) => {
it('should retrieve saved searches from the config.json file', (done) => {
spyOn(authService, 'getUsername').and.callFake(() => testUserName);
spyOn(localStorage, 'getItem').and.callFake(() => testNodeId);
service.innit();
Expand All @@ -84,15 +84,15 @@ describe('SavedSearchesService', () => {
});
});

it('should create saved-searches.json file if it does not exist', (done) => {
it('should create config.json file if it does not exist', (done) => {
spyOn(authService, 'getUsername').and.callFake(() => testUserName);
getNodeContentSpy.and.callFake(() => Promise.resolve(new Blob([''])));
service.innit();

service.getSavedSearches().subscribe((searches) => {
expect(service.nodesApi.getNode).toHaveBeenCalledWith('-my-');
expect(service.searchApi.search).toHaveBeenCalled();
expect(service.nodesApi.createNode).toHaveBeenCalledWith(testNodeId, jasmine.objectContaining({ name: 'saved-searches.json' }));
expect(service.nodesApi.createNode).toHaveBeenCalledWith(testNodeId, jasmine.objectContaining({ name: 'config.json' }));
expect(searches.length).toBe(0);
done();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ export class SavedSearchesService {
this.searchApi.search({
query: {
language: SEARCH_LANGUAGE.AFTS,
query: `cm:name:"saved-searches.json" AND PARENT:"${parentNodeId}"`
query: `cm:name:"config.json" AND PARENT:"${parentNodeId}"`
}
})
).pipe(
Expand Down Expand Up @@ -247,7 +247,7 @@ export class SavedSearchesService {
}
}
private createSavedSearchesNode(parentNodeId: string): Observable<NodeEntry> {
return from(this.nodesApi.createNode(parentNodeId, { name: 'saved-searches.json', nodeType: 'cm:content' }));
return from(this.nodesApi.createNode(parentNodeId, { name: 'config.json', nodeType: 'cm:content' }));
}

private async mapFileContentToSavedSearches(blob: Blob): Promise<Array<SavedSearch>> {
Expand Down

0 comments on commit 3ec3e73

Please sign in to comment.