{"size": 917, "ext": "js", "max_stars_repo_path": "test/http-server.test.js", "max_stars_repo_name": "ammgws/node-picogw", "max_stars_repo_stars_event_min_datetime": "2018-02-23T05:41:16.000Z", "max_stars_repo_stars_event_max_datetime": "2021-09-12T05:40:04.000Z", "max_issues_repo_path": "test/http-server.test.js", "max_issues_repo_name": "ammgws/node-picogw", "max_issues_repo_issues_event_min_datetime": "2018-08-05T23:44:47.000Z", "max_issues_repo_issues_event_max_datetime": "2021-08-21T05:49:19.000Z", "max_forks_repo_path": "test/http-server.test.js", "max_forks_repo_name": "ammgws/node-picogw", "max_forks_repo_forks_event_min_datetime": "2018-01-29T13:27:02.000Z", "max_forks_repo_forks_event_max_datetime": "2021-09-12T07:26:05.000Z"}
{"max_stars_count": 9, "max_issues_count": 2, "max_forks_count": 4, "avg_line_length": 39.8695652174, "max_line_length": 62, "alphanum_fraction": 0.534351145}
const expect = require('chai').expect;
const httpServer = require('../lib/http-server');

describe('applyEndpoints', function() {
    describe('sortEndpoints', function() {
        it('should sort endpoints correctly', function() {
            const func1 = () => {};
            const func2 = () => {};
            const func3 = () => {};
            const func4 = () => {};
            httpServer.endpoint(0, 'get', 'v*/*', func1);
            httpServer.endpoint(0, 'get', '*', func2);
            httpServer.endpoint(1, 'get', 'auth.html', func3);
            httpServer.endpoint(1, 'get', '*', func4);
            const sorted = httpServer.sortEndpointsForTest();
            expect(sorted[0].callback).to.equal(func3);
            expect(sorted[1].callback).to.equal(func1);
            expect(sorted[2].callback).to.equal(func4);
            expect(sorted[3].callback).to.equal(func2);
        });
    });
});
