Spamworldpro Mini Shell
Spamworldpro


Server : Apache
System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64
User : corals ( 1002)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
Directory :  /home/corals/dceprojects.corals.io/node_modules/laravel-echo/tests/util/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //home/corals/dceprojects.corals.io/node_modules/laravel-echo/tests/util/event-formatter.test.ts
import { EventFormatter } from '../../src/util';

describe('EventFormatter', () => {
    let eventFormatter;

    beforeEach(() => {
        eventFormatter = new EventFormatter('App.Events');
    });

    test('prepends an event with a namespace and replaces dot separators with backslashes', () => {
        let formatted = eventFormatter.format('Users.UserCreated');

        expect(formatted).toBe('App\\Events\\Users\\UserCreated');
    });

    test('does not prepend a namespace when an event starts with a dot', () => {
        let formatted = eventFormatter.format('.App\\Users\\UserCreated');

        expect(formatted).toBe('App\\Users\\UserCreated');
    });

    test('does not prepend a namespace when an event starts with a backslash', () => {
        let formatted = eventFormatter.format('\\App\\Users\\UserCreated');

        expect(formatted).toBe('App\\Users\\UserCreated');
    });

    test('does not replace dot separators when the event starts with a dot', () => {
        let formatted = eventFormatter.format('.users.created');

        expect(formatted).toBe('users.created');
    });

    test('does not replace dot separators when the event starts with a backslash', () => {
        let formatted = eventFormatter.format('\\users.created');

        expect(formatted).toBe('users.created');
    });

    test('does not prepend a namespace when none is set', () => {
        let eventFormatter = new EventFormatter(false);

        let formatted = eventFormatter.format('Users.UserCreated');

        expect(formatted).toBe('Users\\UserCreated');
    });
});

Spamworldpro Mini