<commit_before>/*globals describe it */
"use strict";

require("should");

const Stats = require("../lib/Stats");

describe("Stats", () => {
	describe("Error Handling", () => {
		describe("does have", () => {
			it("hasErrors", () => {
				const mockStats = new Stats({
					errors: ["firstError"],
					hash: "1234"
				});
				mockStats.hasErrors().should.be.ok();
			});
			it("hasWarnings", () => {
				const mockStats = new Stats({
					warnings: ["firstError"],
					hash: "1234"
				});
				mockStats.hasWarnings().should.be.ok();
			});
		});
		describe("does not have", () => {
			it("hasErrors", () => {
				const mockStats = new Stats({
					errors: [],
					hash: "1234"
				});
				mockStats.hasErrors().should.not.be.ok();
			});
			it("hasWarnings", () => {
				const mockStats = new Stats({
					warnings: [],
					hash: "1234"
				});
				mockStats.hasWarnings().should.not.be.ok();
			});<commit_msg>add tests for hasErrors and hasWarnings with children taken into account<commit_after>/*globals describe it */
"use strict";

require("should");

const Stats = require("../lib/Stats");

describe("Stats", () => {
	describe("Error Handling", () => {
		describe("does have", () => {
			it("hasErrors", () => {
				const mockStats = new Stats({
					children: [],
					errors: ["firstError"],
					hash: "1234"
				});
				mockStats.hasErrors().should.be.ok();
			});
			it("hasWarnings", () => {
				const mockStats = new Stats({
					children: [],
					warnings: ["firstError"],
					hash: "1234"
				});
				mockStats.hasWarnings().should.be.ok();
			});
		});
		describe("does not have", () => {
			it("hasErrors", () => {
				const mockStats = new Stats({
					children: [],
					errors: [],
					hash: "1234"
				});
				mockStats.hasErrors().should.not.be.ok();
			});
			it("hasWarnings", () => {
				const mockStats = new Stats({
					children: [],
					warnings: [],
					hash: "1234"
				});
				mockStats.hasWarnings().should.not.be.ok();
			});
		});
		describe("children have", () => {
			it("hasErrors", () => {
				const mockStats = new Stats({
					children: [{
						getStats: () => new Stats({
							errors: ["firstError"],
							hash: "5678"
						}),
					}],
					errors: [],
					hash: "1234"
				});
				mockStats.hasErrors().should.be.ok();
			});
			it("hasWarnings", () => {
				const mockStats = new Stats({
					children: [{
						getStats: () => new Stats({
							warnings: ["firstError"],
							hash: "5678"
						}),
					}],
					warnings: [],
					hash: "1234"
				});
				mockStats.hasWarnings().should.be.ok();
			});
{'fraction_non_alphanumeric': 0.21703617269544925, 'fraction_numerical': 0.01866977829638273, 'mean_word_length': 2.547586206896552, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 24, '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': '1036134', 'n_tokens_mistral': 1171, 'n_tokens_neox': 830, 'n_words': 160}