<commit_before>import { forall, assert, nat, Options } from 'jsverify';
import { diagramArbitrary, withTime, addPrevState } from 'cyclejs-test-helpers';
import onionify from 'cycle-onionify';
const htmlLooksLike = require('html-looks-like');
const toHtml = require('snabbdom-to-html'); //snabbdom-to-html's typings are broken

import xs, { Stream } from 'xstream';
import { mockDOMSource, VNode } from '@cycle/dom';
import { mockTimeSource } from '@cycle/time';

import { Counter, defaultState } from '../src/components/counter';

const testOptions: Options = {
    tests: 10,
    size: 200
};

export const expectedHTML = (count: any) => `
    <div>
        <h2>My Awesome Cycle.js app - Page 1</h2>
        <span>Counter: ${count}</span>
        <button>Increase</button>
        <button>Decrease</button>
        <button>Page 2</button>
    </div>
`;

const createTest = (usePrev: boolean) => () => {
    const property = forall(
        diagramArbitrary,
        diagramArbitrary,
        nat,
        (addDiagram, subtractDiagram, count) =>
            withTime(Time => {
                const add$ = Time.diagram(addDiagram);
                const subtract$ = Time.diagram(subtractDiagram);

                const DOM = mockDOMSource({
                    '.add': { click: add$ },
                    '.subtract': { click: subtract$ }
                });

                const state = usePrev ? { count } : { count: undefined };
                const app: any = onionify(addPrevState(Counter, state))(
                    { DOM } as any
                );
                const html$ = (app.DOM as Stream<VNode>).map(toHtml);

                const expected$ = xs
                    .merge(add$.mapTo(+1), subtract$.mapTo(-1))<commit_msg>Remove default state if not testing it<commit_after>import { forall, assert, nat, Options } from 'jsverify';
import { diagramArbitrary, withTime, addPrevState } from 'cyclejs-test-helpers';
import onionify from 'cycle-onionify';
const htmlLooksLike = require('html-looks-like');
const toHtml = require('snabbdom-to-html'); //snabbdom-to-html's typings are broken

import xs, { Stream } from 'xstream';
import { mockDOMSource, VNode } from '@cycle/dom';
import { mockTimeSource } from '@cycle/time';

import { Counter, defaultState } from '../src/components/counter';

const testOptions: Options = {
    tests: 10,
    size: 200
};

export const expectedHTML = (count: any) => `
    <div>
        <h2>My Awesome Cycle.js app - Page 1</h2>
        <span>Counter: ${count}</span>
        <button>Increase</button>
        <button>Decrease</button>
        <button>Page 2</button>
    </div>
`;

const createTest = (usePrev: boolean) => () => {
    const property = forall(
        diagramArbitrary,
        diagramArbitrary,
        nat,
        (addDiagram, subtractDiagram, count) =>
            withTime(Time => {
                const add$ = Time.diagram(addDiagram);
                const subtract$ = Time.diagram(subtractDiagram);

                const DOM = mockDOMSource({
                    '.add': { click: add$ },
                    '.subtract': { click: subtract$ }
                });

                const app: any = onionify(
                    usePrev ? addPrevState(Counter, { count }) : Counter
                )({ DOM } as any);
                const html$ = (app.DOM as Stream<VNode>).map(toHtml);

                const expected$ = xs
                    .merge(add$.mapTo(+1), subtract$.mapTo(-1))
{'fraction_non_alphanumeric': 0.13642918950100952, 'fraction_numerical': 0.006345543697721373, 'mean_word_length': 2.2111111111111112, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 39, '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': '7033057', 'n_tokens_mistral': 1070, 'n_tokens_neox': 993, 'n_words': 252}