<commit_before>'use strict';

const NetworkAdapter = require('../../lib/endpoints/networkadapter');
const Request = require('../../lib/request');

describe('endpoints/networkadapter', () => {
    const request = new Request();
    const getSpy = jest.spyOn(request, 'get').mockImplementation();
    const postSpy = jest.spyOn(request, 'post').mockImplementation();

    test('create()', () => {
        const networkAdapter = new NetworkAdapter(request);
        const data = {
            serverid: 1,
        };

        networkAdapter.create(data);

        expect(postSpy).toHaveBeenCalledWith('/networkadapter/create', data);
    });

    test('delete()', () => {
        const networkAdapter = new NetworkAdapter(request);
        const data = {
            networkadapterid: 1,
        };

        networkAdapter.delete(data);

        expect(postSpy).toHaveBeenCalledWith('/networkadapter/delete', data);
    });

    test('details()', () => {
        const networkAdapter = new NetworkAdapter(request);
        const data = {
            networkadapterid: 1,
        };

        networkAdapter.details(data);

        expect(getSpy).toHaveBeenCalledWith('/networkadapter/details', data);
    });

    test('edit()', () => {
        const networkAdapter = new NetworkAdapter(request);
        const data = {
            networkadapterid: 1,
        };

        networkAdapter.edit(data);

        expect(postSpy).toHaveBeenCalledWith('/networkadapter/edit', data);
    });
});
<commit_msg>Refactor NetworkAdapter test<commit_after>'use strict';

const NetworkAdapter = require('../../lib/endpoints/networkadapter');
const Request = require('../../lib/request');

describe('endpoints/networkadapter', () => {
    let networkAdapter;
    let request;

    beforeEach(() => {
        request = new Request();
        networkAdapter = new NetworkAdapter(request);
    });

    test('create()', () => {
        const spy = globalThis.setupRequestSpy(request, 'post');
        const data = {
            serverid: 1,
        };

        networkAdapter.create(data);

        expect(spy).toHaveBeenCalledWith('/networkadapter/create', data);
    });

    test('delete()', () => {
        const spy = globalThis.setupRequestSpy(request, 'post');
        const data = {
            networkadapterid: 1,
        };

        networkAdapter.delete(data);

        expect(spy).toHaveBeenCalledWith('/networkadapter/delete', data);
    });

    test('details()', () => {
        const spy = globalThis.setupRequestSpy(request, 'get');
        const data = {
            networkadapterid: 1,
        };

        networkAdapter.details(data);

        expect(spy).toHaveBeenCalledWith('/networkadapter/details', data);
    });

    test('edit()', () => {
        const spy = globalThis.setupRequestSpy(request, 'post');
        const data = {
            networkadapterid: 1,
        };

        networkAdapter.edit(data);

        expect(spy).toHaveBeenCalledWith('/networkadapter/edit', data);
    });
});

{'fraction_non_alphanumeric': 0.155, 'fraction_numerical': 0.0026666666666666666, 'mean_word_length': 2.5347467608951706, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 14, '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': '4802044', 'n_tokens_mistral': 835, 'n_tokens_neox': 807, 'n_words': 139}