<commit_before>import { toId } from '@storybook/csf';

import { constructUrl } from '../url';

jest.mock('@storybook/node-logger');

const id = toId('someKind', 'someStory');

describe('Construct URL for Storyshots', () => {
  it('can use a url without path and without query params', () => {
    expect(constructUrl('http://localhost:9001', id)).toEqual(
      'http://localhost:9001/iframe.html?id=somekind--somestory'
    );
  });

  it('can use a url without path (but slash) and without query params', () => {
    expect(constructUrl('http://localhost:9001/', id)).toEqual(
      'http://localhost:9001/iframe.html?id=somekind--somestory'
    );
  });

  it('can use a url without path and with query params', () => {
    expect(constructUrl('http://localhost:9001?hello=world', id)).toEqual(
      'http://localhost:9001/iframe.html?hello=world&id=somekind--somestory'
    );
  });

  it('can use a url without path (buth slash) and with query params', () => {
    expect(constructUrl('http://localhost:9001/?hello=world', id)).toEqual(
      'http://localhost:9001/iframe.html?hello=world&id=somekind--somestory'
    );
  });

  it('can use a url with some path and query params', () => {
    expect(constructUrl('http://localhost:9001/nice-path?hello=world', id)).toEqual(
      'http://localhost:9001/nice-path/iframe.html?hello=world&id=somekind--somestory'
    );
  });

  it('can use a url with some path (slash) and query params', () => {
    expect(constructUrl('http://localhost:9001/nice-path/?hello=world', id)).toEqual(
      'http://localhost:9001/nice-path/iframe.html?hello=world&id=somekind--somestory'
    );
  });

  it('can use a url with file protocol', () => {
    expect(constructUrl('file://users/storybook', id)).toEqual(
      'file://users/storybook/iframe.html?id=somekind--somestory'
    );
  });
});
<commit_msg>test: add a test which covers username and password authentication<commit_after>import { toId } from '@storybook/csf';

import { constructUrl } from '../url';

jest.mock('@storybook/node-logger');

const id = toId('someKind', 'someStory');

describe('Construct URL for Storyshots', () => {
  it('can use a url without path and without query params', () => {
    expect(constructUrl('http://localhost:9001', id)).toEqual(
      'http://localhost:9001/iframe.html?id=somekind--somestory'
    );
  });

  it('can use a url without path (but slash) and without query params', () => {
    expect(constructUrl('http://localhost:9001/', id)).toEqual(
      'http://localhost:9001/iframe.html?id=somekind--somestory'
    );
  });

  it('can use a url without path and with query params', () => {
    expect(constructUrl('http://localhost:9001?hello=world', id)).toEqual(
      'http://localhost:9001/iframe.html?hello=world&id=somekind--somestory'
    );
  });

  it('can use a url without path (buth slash) and with query params', () => {
    expect(constructUrl('http://localhost:9001/?hello=world', id)).toEqual(
      'http://localhost:9001/iframe.html?hello=world&id=somekind--somestory'
    );
  });

  it('can use a url with some path and query params', () => {
    expect(constructUrl('http://localhost:9001/nice-path?hello=world', id)).toEqual(
      'http://localhost:9001/nice-path/iframe.html?hello=world&id=somekind--somestory'
    );
  });

  it('can use a url with some path (slash) and query params', () => {
    expect(constructUrl('http://localhost:9001/nice-path/?hello=world', id)).toEqual(
      'http://localhost:9001/nice-path/iframe.html?hello=world&id=somekind--somestory'
    );
  });

  it('can use a url with username and password and query params', () => {
    expect(
      constructUrl('http://username:password@localhost:9001/nice-path/?hello=world', id)
    ).toEqual(
      'http://username:password@localhost:9001/nice-path/iframe.html?hello=world&id=somekind--somestory'
    );
  });

  it('can use a url with file protocol', () => {
    expect(constructUrl('file://users/storybook', id)).toEqual(
      'file://users/storybook/iframe.html?id=somekind--somestory'
    );
  });
});

{'fraction_non_alphanumeric': 0.1876232741617357, 'fraction_numerical': 0.02564102564102564, 'mean_word_length': 3.9475609756097563, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 20, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2275732', 'n_tokens_mistral': 1381, 'n_tokens_neox': 1300, 'n_words': 245}