<commit_before><commit_msg>Add P5js clip test<commit_after>import * as fs from 'fs-extra'
import { join } from 'path'
import { Expression } from '../../../Values'
import RenderRequest from '../../RenderRequest'
import P5jsRenderer from './P5js'

jest.mock('./P5Hooks', () => ({ default: class {
    public p5 = {
        canvas: {},
        createCanvas: () => {}
    }
}}))

describe('P5js', () => {
    const renderer = new P5jsRenderer()
    it('Should accessible specified global objects', async () => {
        const sketch = (await fs.readFile(join(__dirname, 'specFixtures/globals.js'))).toString()
        const request = new RenderRequest({
            width: 100,
            height: 100,
            parameters: {
                sketch: new Expression('javascript', sketch),
                opacity: 1,
            }
        }).toPreRenderingRequest()

        await renderer.beforeRender(request)
    })
})
{'fraction_non_alphanumeric': 0.15233949945593037, 'fraction_numerical': 0.015233949945593036, 'mean_word_length': 2.36996336996337, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '2493238', 'n_tokens_mistral': 263, 'n_tokens_neox': 258, 'n_words': 65}