<commit_before>const cognitive = require('../../src/index.js');
const config = require('../config.js');
const should = require('should');
const fs = require('fs');

describe('Bing Image Search v7', () => {

    const client = new cognitive.bingImageSearchV7({
        apiKey: config.bingSearchV7.apiKey,
        endpoint: config.bingSearchV7.endpoint
    });

    describe('Image Insights', () => {
        it('should get image insights', (done) => {
            const body = fs.readFileSync('test/assets/cat.jpg');
            const headers = {};
            const parameters = {};

            client.imageInsights({
                parameters,
                headers,
                body
            })
            .then((response) => {
                should(response).not.be.undefined();
                done();
            }).catch((err) => {
                done(new Error("Error making request:" + err));
            });
        })

    })

    describe('search', () => {
        it('should get results for a query', (done) => {
            const parameters = {
                "q": "cats",
                "count": "100",
                "offset": "10"
            };
            const headers = {};

            client.search({
                parameters,
                headers
            }).then((response) => {
                should(response).not.be.undefined();
                should(response).have.property("totalEstimatedMatches");
                done();
            }).catch((err) => {
                done(new Error("Error making request:" + err));
            });<commit_msg>Fixed bing image search v7 image insights test<commit_after>const cognitive = require('../../src/index.js');
const config = require('../config.js');
const should = require('should');
const fs = require('fs');

describe('Bing Image Search v7', () => {

    const client = new cognitive.bingImageSearchV7({
        apiKey: config.bingSearchV7.apiKey,
        endpoint: config.bingSearchV7.endpoint
    });

    describe('Image Insights', () => {
        it('should get image insights', (done) => {
            const body = {};
            const headers = {};
            const parameters = {
                'imgUrl': 'https://github.com/Microsoft/Cognitive-Face-Windows/blob/master/Data/detection1.jpg?raw=true'
            };

            client.imageInsights({
                parameters,
                headers,
                body
            })
            .then((response) => {
                should(response).not.be.undefined();
                should(response).have.properties(['imageInsightsToken', 'bestRepresentativeQuery', 'imageCaption'])
                done();
            }).catch((err) => {
                done(new Error("Error making request:" + err));
            });
        })

    })

    describe('search', () => {
        it('should get results for a query', (done) => {
            const parameters = {
                "q": "cats",
                "count": "100",
                "offset": "10"
            };
            const headers = {};

            client.search({
                parameters,
                headers
            }).then((response) => {
                should(response).not.be.undefined();
                should(response).have.property("totalEstimatedMatches");
                done();
            }).catch((err) => {
                done(new Error("Error making request:" + err));
            });
{'fraction_non_alphanumeric': 0.15076833864888373, 'fraction_numerical': 0.0057987822557262975, 'mean_word_length': 1.5330396475770924, 'pattern_counts': {'":': 6, '<': 3, '<?xml version=': 0, '>': 21, 'https://': 1, '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': '1542037', 'n_tokens_mistral': 888, 'n_tokens_neox': 830, 'n_words': 175}