<commit_before>'use strict';

var assert = require('assert');
var sinon = require('sinon');

var PaymentCard = require('../../lib/endpoints/paymentcard');
var Request = require('../../lib/request');

describe('endpoints/paymentcard', function () {
    describe('add', function () {
        it('should set the request URL', function () {
            var request = new Request();
            var paymentCard;
            var stub;

            stub = sinon.stub(request, 'post', function (url) {
                assert.strictEqual(url, '/paymentcard/add');
            });

            paymentCard = new PaymentCard(request);
            paymentCard.add();

            assert.ok(stub.called);
        });

        it('should set the request body', function () {
            var request = new Request();
            var paymentCard;
            var stub;
            var expected = {
                description: 'description',
            };

            stub = sinon.stub(request, 'post', function (url, data) {
                assert.deepEqual(data, expected);
            });

            paymentCard = new PaymentCard(request);
            paymentCard.add(expected);

            assert.ok(stub.called);
        });
    });

    describe('delete', function () {
        it('should set the request URL', function () {
            var request = new Request();
            var paymentCard;
            var stub;

            stub = sinon.stub(request, 'post', function (url) {
                assert.strictEqual(url, '/paymentcard/delete');
            });

            paymentCard = new PaymentCard(request);
            paymentCard.delete();

            assert.ok(stub.called);
        });

        it('should set the request body', function () {
            var request = new Request();
            var paymentCard;
            var stub;
            var expected = {
                paymentcardid: 1,
            };

            stub = sinon.stub(request, 'post', function (url, data) {
                assert.deepEqual(data, expected);
            });

            paymentCard = new PaymentCard(request);
            paymentCard.delete(expected);

            assert.ok(stub.called);
        });
    });

    describe('edit', function () {
        it('should set the request URL', function () {
            var request = new Request();
            var paymentCard;
            var stub;

            stub = sinon.stub(request, 'post', function (url) {
                assert.strictEqual(url, '/paymentcard/edit');
            });

            paymentCard = new PaymentCard(request);
            paymentCard.edit();

            assert.ok(stub.called);
        });

        it('should set the request body', function () {
            var request = new Request();
            var paymentCard;
            var stub;
            var expected = {
                paymentcardid: 1,
            };

            stub = sinon.stub(request, 'post', function (url, data) {
                assert.deepEqual(data, expected);
            });

            paymentCard = new PaymentCard(request);
            paymentCard.edit(expected);

            assert.ok(stub.called);
        });
    });

    describe('list', function () {
        it('should set the request URL', function () {
            var request = new Request();
            var paymentCard;
            var stub;

            stub = sinon.stub(request, 'get', function (url) {
                assert.strictEqual(url, '/paymentcard/list');
            });

            paymentCard = new PaymentCard(request);
            paymentCard.list();

            assert.ok(stub.called);
        });
    });
});
<commit_msg>Rewrite PaymentCard tests to ES2015<commit_after>'use strict';

const assert = require('assert');
const sinon = require('sinon');

const PaymentCard = require('../../lib/endpoints/paymentcard');
const Request = require('../../lib/request');

describe('endpoints/paymentcard', () => {
    describe('add', () => {
        it('should set the request URL', () => {
            const request = new Request();
            const paymentCard = new PaymentCard(request);
            const stub = sinon.stub(request, 'post', (url) => {
                assert.strictEqual(url, '/paymentcard/add');
            });

            paymentCard.add();

            assert.ok(stub.called);
        });

        it('should set the request body', () => {
            const request = new Request();
            const paymentCard = new PaymentCard(request);
            const expected = {
                description: 'description',
            };

            const stub = sinon.stub(request, 'post', (url, data) => {
                assert.deepEqual(data, expected);
            });

            paymentCard.add(expected);

            assert.ok(stub.called);
        });
    });

    describe('delete', () => {
        it('should set the request URL', () => {
            const request = new Request();
            const paymentCard = new PaymentCard(request);
            const stub = sinon.stub(request, 'post', (url) => {
                assert.strictEqual(url, '/paymentcard/delete');
            });

            paymentCard.delete();

            assert.ok(stub.called);
        });

        it('should set the request body', () => {
            const request = new Request();
            const paymentCard = new PaymentCard(request);
            const expected = {
                paymentcardid: 1,
            };

            const stub = sinon.stub(request, 'post', (url, data) => {
                assert.deepEqual(data, expected);
            });

            paymentCard.delete(expected);

            assert.ok(stub.called);
        });
    });

    describe('edit', () => {
        it('should set the request URL', () => {
            const request = new Request();
            const paymentCard = new PaymentCard(request);
            const stub = sinon.stub(request, 'post', (url) => {
                assert.strictEqual(url, '/paymentcard/edit');
            });

            paymentCard.edit();

            assert.ok(stub.called);
        });

        it('should set the request body', () => {
            const request = new Request();
            const paymentCard = new PaymentCard(request);
            const expected = {
                paymentcardid: 1,
            };

            const stub = sinon.stub(request, 'post', (url, data) => {
                assert.deepEqual(data, expected);
            });

            paymentCard.edit(expected);

            assert.ok(stub.called);
        });
    });

    describe('list', () => {
        it('should set the request URL', () => {
            const request = new Request();
            const paymentCard = new PaymentCard(request);
            const stub = sinon.stub(request, 'get', (url) => {
                assert.strictEqual(url, '/paymentcard/list');
            });

            paymentCard.list();

            assert.ok(stub.called);
        });
    });
});

{'fraction_non_alphanumeric': 0.13617508224860536, 'fraction_numerical': 0.0011443284222571878, 'mean_word_length': 1.586755456899741, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 22, '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': '7223235', 'n_tokens_mistral': 1769, 'n_tokens_neox': 1722, 'n_words': 413}