Uname:Linux machinox-server 6.17.0-1013-aws #13~24.04.1-Ubuntu SMP Fri Apr 24 21:36:58 UTC 2026 aarch64

Base Dir : /var/www/machinox.in

User : root


403WebShell
403Webshell
Server IP : 13.235.167.51  /  Your IP : 216.73.217.116
Web Server : Apache
System : Linux machinox-server 6.17.0-1013-aws #13~24.04.1-Ubuntu SMP Fri Apr 24 21:36:58 UTC 2026 aarch64
User : root ( 0)
PHP Version : 8.2.29
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /var/www/control.machinox.in/node_modules/next/dist/telemetry/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/control.machinox.in/node_modules/next/dist/telemetry/post-telemetry-payload.test.js
"use strict";
Object.defineProperty(exports, "__esModule", {
    value: true
});
const _posttelemetrypayload = require("./post-telemetry-payload");
describe('postNextTelemetryPayload', ()=>{
    let originalFetch;
    beforeEach(()=>{
        originalFetch = global.fetch;
    });
    afterEach(()=>{
        global.fetch = originalFetch;
    });
    it('sends telemetry payload successfully', async ()=>{
        const mockFetch = jest.fn().mockResolvedValue({
            ok: true
        });
        global.fetch = mockFetch;
        const payload = {
            meta: {
                version: '1.0'
            },
            context: {
                anonymousId: 'test-id',
                projectId: 'test-project',
                sessionId: 'test-session'
            },
            events: [
                {
                    eventName: 'test-event',
                    fields: {
                        foo: 'bar'
                    }
                }
            ]
        };
        await (0, _posttelemetrypayload.postNextTelemetryPayload)(payload);
        expect(mockFetch).toHaveBeenCalledWith('https://telemetry.nextjs.org/api/v1/record', {
            method: 'POST',
            body: JSON.stringify(payload),
            headers: {
                'content-type': 'application/json'
            },
            signal: expect.any(AbortSignal)
        });
    });
    it('retries on failure', async ()=>{
        const mockFetch = jest.fn().mockRejectedValueOnce(new Error('Network error')).mockResolvedValueOnce({
            ok: true
        });
        global.fetch = mockFetch;
        const payload = {
            meta: {},
            context: {
                anonymousId: 'test-id',
                projectId: 'test-project',
                sessionId: 'test-session'
            },
            events: []
        };
        await (0, _posttelemetrypayload.postNextTelemetryPayload)(payload);
        expect(mockFetch).toHaveBeenCalledTimes(2);
    });
    it('swallows errors after retries exhausted', async ()=>{
        const mockFetch = jest.fn().mockRejectedValue(new Error('Network error'));
        global.fetch = mockFetch;
        const payload = {
            meta: {},
            context: {
                anonymousId: 'test-id',
                projectId: 'test-project',
                sessionId: 'test-session'
            },
            events: []
        };
        // Should not throw
        await (0, _posttelemetrypayload.postNextTelemetryPayload)(payload);
        expect(mockFetch).toHaveBeenCalledTimes(2) // Initial try + 1 retry
        ;
    });
});

//# sourceMappingURL=post-telemetry-payload.test.js.map

Youez - 2016 - github.com/yon3zu
LinuXploit