<commit_before>import HTTP
import Foundation
import Node
import Vapor

// MARK: Assertions

extension Response {
    /// Asserts the response body contains a
    /// desired byte array.
    @discardableResult
    public func assertBody(
        contains b: BytesConvertible,
        _ message: String? = nil,
        file: StaticString = #file,
        line: UInt = #line
    ) throws -> Response {
        let desired = try b.testMakeBytes(file: file, line: line)
        let body = try testBody(file: file, line: line)

        if !body.contains(desired) {
            onFail(
                message ?? "Body assertion failed. '\(body.makeString())' does not contain '\(desired.makeString())'",
                file,
                line
            )
        }
        return self
    }
    
    /// Asserts the response body equals
    /// a desired string.
    @discardableResult
    public func assertBody(
        equals desired: String,
        _ message: String? = nil,
        file: StaticString = #file,
        line: UInt = #line
    ) throws -> Response {
        let body = try testBody(file: file, line: line)
        
        if body.makeString() != desired {
            onFail(
                message ?? "Body assertion failed. '\(body.makeString())' does not equal '\(desired)'",
                file,
                line
            )
        }
        return self
    }
    
    /// Asserts the response body contains a
    /// desired byte array.<commit_msg>convention of 'expectation' over 'desired'<commit_after>import HTTP
import Foundation
import Node
import Vapor

// MARK: Assertions

extension Response {
    /// Asserts the response body contains a
    /// desired byte array.
    @discardableResult
    public func assertBody(
        contains b: BytesConvertible,
        _ message: String? = nil,
        file: StaticString = #file,
        line: UInt = #line
    ) throws -> Response {
        let desired = try b.testMakeBytes(file: file, line: line)
        let body = try testBody(file: file, line: line)

        if !body.contains(desired) {
            onFail(
                message ?? "Body assertion failed. '\(body.makeString())' does not contain '\(desired.makeString())'",
                file,
                line
            )
        }
        return self
    }
    
    /// Asserts the response body equals
    /// a desired string.
    @discardableResult
    public func assertBody(
        equals expectation: String,
        _ message: String? = nil,
        file: StaticString = #file,
        line: UInt = #line
    ) throws -> Response {
        let body = try testBody(file: file, line: line)
        
        if body.makeString() != expectation {
            onFail(
                message ?? "Body assertion failed. '\(body.makeString())' does not equal '\(expectation)'",
                file,
                line
            )
        }
        return self
    }
    
    /// Asserts the response body contains a
    /// desired byte array.
{'fraction_non_alphanumeric': 0.09910209511140672, 'fraction_numerical': 0.0, 'mean_word_length': 1.6833184656556646, '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': '5261152', 'n_tokens_mistral': 809, 'n_tokens_neox': 786, 'n_words': 259}