<commit_before>import { expect } from 'chai';
import { createServer } from 'service-mocker/server';

import mime from 'mime-component';

import {
  uniquePath,
  sendRequest,
} from '../../helpers/';

export default function () {
  const { router } = createServer();

  describe('res.forward(url)', () => {
    it('should forward the request with given URL', async () => {
      const path = uniquePath();

      router.get(path, (_req, res) => {
        res.forward('/');
      });

      const { body } = await sendRequest(path);
      const realResponse = await sendRequest('/');

      expect(body).to.equal(realResponse.body);
    });

    it('should forward a remote address', async () => {
      const baseURL = 'https://api.spotify.com';
      const requsetInfo = `${baseURL}/albums/3oTKl46yD2fsb1dtUYq6Nn`;

      const { router } = createServer(baseURL);

      router.get('/albums/:id', (req, res) => {
        res.forward(`${req.baseURL}/v1${req.path}`);
      });

      const { body } = await sendRequest(requsetInfo);

      const realResponse = await sendRequest(requsetInfo);
<commit_msg>fix(test/req.forward): switch to github api<commit_after>import { expect } from 'chai';
import { createServer } from 'service-mocker/server';

import mime from 'mime-component';

import {
  uniquePath,
  sendRequest,
} from '../../helpers/';

export default function () {
  const { router } = createServer();

  describe('res.forward(url)', () => {
    it('should forward the request with given URL', async () => {
      const path = uniquePath();

      router.get(path, (_req, res) => {
        res.forward('/');
      });

      const { body } = await sendRequest(path);
      const realResponse = await sendRequest('/');

      expect(body).to.equal(realResponse.body);
    });

    it('should forward a remote address', async () => {
      const baseURL = 'https://api.github.com';
      const requsetInfo = `${baseURL}/organizations/service-mocker`;

      const { router } = createServer(baseURL);

      router.get('/organizations/:org', (req, res) => {
        res.forward(`${req.baseURL}/orgs/${req.params.org}`);
      });

      const { body } = await sendRequest(requsetInfo);

      const realResponse = await sendRequest(requsetInfo);

{'fraction_non_alphanumeric': 0.16762749445676275, 'fraction_numerical': 0.0031042128603104213, 'mean_word_length': 3.0575539568345325, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, 'https://': 2, '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': '6527744', 'n_tokens_mistral': 688, 'n_tokens_neox': 681, 'n_words': 154}