<commit_before>import './polyfill';
import * as WHS from '../src/index';
import {FogModule} from '../src/modules/app/FogModule';
import gl from 'gl';

const app = new WHS.App();
const modules = {};

// console.log((typeof performance === 'undefined' ? Date : performance).now());

test('ElementModule', () => {
  modules.element = new WHS.app.ElementModule();
});

test('SceneModule', () => {
  modules.scene = new WHS.app.SceneModule();
});

test('CameraModule', () => {
  modules.camera = new WHS.app.CameraModule();
});

test('RenderingModule', () => {
  modules.rendering = new WHS.app.RenderingModule({
    renderer: {
      context: gl(10, 10)
    }
  });
});

test('PostProcessorModule', () => {
  modules.postprocessor = new WHS.app.PostProcessorModule();
});

test('ResizeModule', () => {
  modules.resize = new WHS.app.ResizeModule();
});

test('VirtualMouseModule', () => {
  modules.mouse = new WHS.app.VirtualMouseModule();
});


// TODO move Modules tests into individual specs
const defaultFog = new FogModule();
test('FogModule', () => {
  modules.fog = defaultFog;
});
// TODO figure out a better approach to add assertions
// and cleaner way to assert object properties
test('Default Fog is a FogExp2', () => {
  expect(defaultFog.fog.isFogExp2).toBeTruthy();
});

test('Fog has the default color', () => {
  expect(defaultFog.fog.color.getHex()).toBe(0xefd1b5);
});

test('Fog has the default density', () => {
  expect(defaultFog.fog.density).toBe(0.020);
});

const linearFog = new FogModule({}, 'linear');
test('Linear Fog is a Fog', () => {
  expect(linearFog.fog.isFog).toBeTruthy();
});

test('Linear Fog has the default color', () => {
  expect(linearFog.fog.color.getHex()).toBe(0xefd1b5);
});

test('Linear Fog has the default near value', () => {
  expect(linearFog.fog.near).toBe(10);
});

test('Linear Fog has the default far value', () => {
  expect(linearFog.fog.far).toBe(1000);
});

const fogColor = 0xffffff;
const fogDensity = 0.025;
const customExp2Fog = new FogModule({color: fogColor, density: fogDensity});
test('Custom exp2 Fog is set with the constructor params', () => {
  expect(customExp2Fog.fog.color.getHex()).toBe(fogColor);
  expect(customExp2Fog.fog.density).toBe(fogDensity);
});

test('Applying basic modules to app', () => {
  app
    .module(modules.element)
    .module(modules.scene)
    .module(modules.camera)
    .module(modules.rendering)
    .module(modules.postprocessor)
    .module(modules.resize)<commit_msg>Use ‘describe’ to structure the tests for FogModule - #207<commit_after>import './polyfill';
import * as WHS from '../src/index';
import {FogModule} from '../src/modules/app/FogModule';
import gl from 'gl';

const app = new WHS.App();
const modules = {};

// console.log((typeof performance === 'undefined' ? Date : performance).now());

test('ElementModule', () => {
  modules.element = new WHS.app.ElementModule();
});

test('SceneModule', () => {
  modules.scene = new WHS.app.SceneModule();
});

test('CameraModule', () => {
  modules.camera = new WHS.app.CameraModule();
});

test('RenderingModule', () => {
  modules.rendering = new WHS.app.RenderingModule({
    renderer: {
      context: gl(10, 10)
    }
  });
});

test('PostProcessorModule', () => {
  modules.postprocessor = new WHS.app.PostProcessorModule();
});

test('ResizeModule', () => {
  modules.resize = new WHS.app.ResizeModule();
});

test('VirtualMouseModule', () => {
  modules.mouse = new WHS.app.VirtualMouseModule();
});


// TODO move Modules tests into individual specs
const defaultFog = new FogModule();
test('FogModule', () => {
  modules.fog = defaultFog;
});
describe('Default Fog', () => {
  test('is a FogExp2', () => {
    expect(defaultFog.fog.isFogExp2).toBeTruthy();
  });

  test('has the default color', () => {
    expect(defaultFog.fog.color.getHex()).toBe(0xefd1b5);
  });

  test('has the default density', () => {
    expect(defaultFog.fog.density).toBe(0.020);
  });
});

describe('Default Fog', () => {
  const linearFog = new FogModule({}, 'linear');
  test('is a Fog', () => {
    expect(linearFog.fog.isFog).toBeTruthy();
  });

  test('has the default color', () => {
    expect(linearFog.fog.color.getHex()).toBe(0xefd1b5);
  });

  test('has the default near value', () => {
    expect(linearFog.fog.near).toBe(10);
  });

  test('has the default far value', () => {
    expect(linearFog.fog.far).toBe(1000);
  });
});

describe('Custom Fog', () => {
  const fogColor = 0xffffff;
  const fogDensity = 0.025;
  const customExp2Fog = new FogModule({color: fogColor, density: fogDensity});
  test('Custom exp2 Fog is set with the constructor params', () => {
    expect(customExp2Fog.fog.color.getHex()).toBe(fogColor);
    expect(customExp2Fog.fog.density).toBe(fogDensity);
  });
});

test('Applying basic modules to app', () => {
  app
    .module(modules.element)
    .module(modules.scene)
    .module(modules.camera)
    .module(modules.rendering)
    .module(modules.postprocessor)
    .module(modules.resize)
{'fraction_non_alphanumeric': 0.1907051282051282, 'fraction_numerical': 0.013020833333333334, 'mean_word_length': 4.206465067778937, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 40, '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': '7109759', 'n_tokens_mistral': 1740, 'n_tokens_neox': 1701, 'n_words': 337}