Skip to content

Commit

Permalink
Rewrote the tests to comply to the new behaviour
Browse files Browse the repository at this point in the history
  • Loading branch information
crisnicandrei committed Oct 19, 2023
1 parent 2e8436c commit 57eb161
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/app/search/services/search.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,32 @@ describe('SearchService', () => {
expect(search[0]).toBe(expectedSearch);
expect(search[1]).toEqual(expectedTags);
}

it('removes the first and last quotation marks from tag names', () => {
tags.setTags([
{ name: 'Potato', tagId: 0 },
{ name: '"Potato"', tagId: 1 },
]);
const searchTokens = service.parseSearchTerm('tag:""Potato""');
expect(searchTokens[1].length).toBe(1);
expect(searchTokens[1][0].tagId).toBe(1);
});

it('handles tag edge cases', () => {
tags.setTags([{ name: 'tag:Test' }]);
expectSearchToBe(
service.parseSearchTerm('tag:"tag:"Test""'),
'tag:"tag:"Test""',
[]
);
});

it('handles returns the tags correctly if they have quotation marks', () => {
tags.setTags([{ name: 'tag:"Test"' }]);
expectSearchToBe(service.parseSearchTerm('tag:"tag:"Test""'), undefined, [
{ name: 'tag:"Test"' },
]);
});
});

describe('getResultsInCurrentFolder', () => {
Expand Down

0 comments on commit 57eb161

Please sign in to comment.