T.ME/BIBIL_0DAY
CasperSecurity


Server : Apache/2
System : Linux server-15-235-50-60 5.15.0-164-generic #174-Ubuntu SMP Fri Nov 14 20:25:16 UTC 2025 x86_64
User : gositeme ( 1004)
PHP Version : 8.2.29
Disable Function : exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Directory :  /home/gositeme/domains/lavocat.quebec/private_html/node_modules/goober/src/__tests__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/gositeme/domains/lavocat.quebec/private_html/node_modules/goober/src/__tests__/css.test.js
import { css, glob, keyframes } from '../css';
import { hash } from '../core/hash';
import { compile } from '../core/compile';
import { getSheet } from '../core/get-sheet';

jest.mock('../core/hash', () => ({
    hash: jest.fn().mockReturnValue('hash()')
}));

jest.mock('../core/compile', () => ({
    compile: jest.fn().mockReturnValue('compile()')
}));

jest.mock('../core/get-sheet', () => ({
    getSheet: jest.fn().mockReturnValue('getSheet()')
}));

describe('css', () => {
    beforeEach(() => {
        hash.mockClear();
        compile.mockClear();
        getSheet.mockClear();
    });

    it('type', () => {
        expect(typeof css).toEqual('function');
    });

    it('args: tagged', () => {
        const out = css`base${1}`;

        expect(compile).toBeCalledWith(['base', ''], [1], undefined);
        expect(getSheet).toBeCalled();
        expect(hash).toBeCalledWith('compile()', 'getSheet()', undefined, undefined, undefined);
        expect(out).toEqual('hash()');
    });

    it('args: object', () => {
        const out = css({ foo: 1 });

        expect(hash).toBeCalledWith({ foo: 1 }, 'getSheet()', undefined, undefined, undefined);
        expect(compile).not.toBeCalled();
        expect(getSheet).toBeCalled();
        expect(out).toEqual('hash()');
    });

    it('args: array', () => {
        const propsBased = jest.fn().mockReturnValue({
            backgroundColor: 'gold'
        });
        const payload = [{ foo: 1 }, { baz: 2 }, { opacity: 0, color: 'red' }, propsBased];
        const out = css(payload);

        expect(propsBased).toHaveBeenCalled();
        expect(hash).toBeCalledWith(
            { foo: 1, baz: 2, opacity: 0, color: 'red', backgroundColor: 'gold' },
            'getSheet()',
            undefined,
            undefined,
            undefined
        );
        expect(compile).not.toBeCalled();
        expect(getSheet).toBeCalled();
        expect(out).toEqual('hash()');
    });

    it('args: function', () => {
        const incoming = { foo: 'foo' };
        const out = css.call({ p: incoming }, (props) => ({ foo: props.foo }));

        expect(hash).toBeCalledWith(incoming, 'getSheet()', undefined, undefined, undefined);
        expect(compile).not.toBeCalled();
        expect(getSheet).toBeCalled();
        expect(out).toEqual('hash()');
    });

    it('bind', () => {
        const target = '';
        const p = {};
        const g = true;
        const out = css.bind({
            target,
            p,
            g
        })`foo: 1`;

        expect(hash).toBeCalledWith('compile()', 'getSheet()', true, undefined, undefined);
        expect(compile).toBeCalledWith(['foo: 1'], [], p);
        expect(getSheet).toBeCalledWith(target);
        expect(out).toEqual('hash()');
    });
});

describe('glob', () => {
    it('type', () => {
        expect(typeof glob).toEqual('function');
    });

    it('args: g', () => {
        glob`a:b`;
        expect(hash).toBeCalledWith('compile()', 'getSheet()', 1, undefined, undefined);
    });
});

describe('keyframes', () => {
    it('type', () => {
        expect(typeof keyframes).toEqual('function');
    });

    it('args: k', () => {
        keyframes`a:b`;
        expect(hash).toBeCalledWith('compile()', 'getSheet()', undefined, undefined, 1);
    });
});

CasperSecurity Mini