<commit_before>const run = require('server/test/run');
const stat = require('./');
const error = require('server/router/error');

describe('static plugin', () => {
  it('exists', async () => {
    await run().get('/');
    expect(stat).toBeDefined();
    expect(stat.name).toBe('static');
    expect(stat.options).toBeDefined();
  });

  it('static', async () => {
    const res = await run({ public: 'test' }, [
      async ctx => {
        const file = path.join(ctx.options.public, ctx.url);
        return {
          file,
          message: 'I am displayed'
        };
        // console.log(file, ':', (await fs.readFile(file, 'utf8')).length);
      }
    ]).get('/logo.png');
    expect(res.body).toBe('badfgasdfsd');
    expect(res.statusCode).toBe(200);
    expect(res.headers['content-type']).toBe('image/png');
  });

  it('non-existing static', async () => {
    const res = await run({ public: 'test' }).get('/non-existing.png');
    expect(res.statusCode).toBe(404);
  });

});<commit_msg>Debugging windows<commit_after>const run = require('server/test/run');
const stat = require('./');
const error = require('server/router/error');

describe('static plugin', () => {
  it('exists', async () => {
    await run().get('/');
    expect(stat).toBeDefined();
    expect(stat.name).toBe('static');
    expect(stat.options).toBeDefined();
  });

  it('static', async () => {
    const res = await run({ public: 'test' }, [
      async ctx => {
        // const file = path.join(ctx.options.public, ctx.url);
        return JSON.stringify({
          pub: ctx.options.public,
          url: ctx.url,
          message: 'I am displayed'
        });
        // console.log(file, ':', (await fs.readFile(file, 'utf8')).length);
      }
    ]).get('/logo.png');
    expect(res.body).toBe('badfgasdfsd');
    expect(res.statusCode).toBe(200);
    expect(res.headers['content-type']).toBe('image/png');
  });

  it('non-existing static', async () => {
    const res = await run({ public: 'test' }).get('/non-existing.png');
    expect(res.statusCode).toBe(404);
  });

});
{'fraction_non_alphanumeric': 0.21820809248554912, 'fraction_numerical': 0.00674373795761079, 'mean_word_length': 2.963740458015267, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, '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': '3598152', 'n_tokens_mistral': 673, 'n_tokens_neox': 660, 'n_words': 119}