github.com/pyroscope-io/pyroscope@v0.37.3-0.20230725203016-5f6947968bd0/webapp/javascript/pages/formatTitle.spec.ts (about)

     1  import { formatTitle } from './formatTitle';
     2  import { brandQuery } from '@webapp/models/query';
     3  
     4  describe('format title', () => {
     5    describe('when both left and right query are falsy', () => {
     6      it('returns only the page title', () => {
     7        expect(formatTitle('mypage')).toBe('mypage');
     8        expect(formatTitle('mypage', brandQuery(''), brandQuery(''))).toBe(
     9          'mypage'
    10        );
    11      });
    12    });
    13  
    14    describe('when only a single query is set', () => {
    15      it('sets it correctly', () => {
    16        expect(formatTitle('mypage', brandQuery('myquery'))).toBe(
    17          'mypage | myquery'
    18        );
    19      });
    20    });
    21  
    22    describe('when both queries are set', () => {
    23      it('sets it correctly', () => {
    24        expect(
    25          formatTitle('mypage', brandQuery('myquery1'), brandQuery('myquery2'))
    26        ).toBe('mypage | myquery1 and myquery2');
    27      });
    28    });
    29  });