Uname: Linux webm016.cluster127.gra.hosting.ovh.net 5.15.167-ovh-vps-grsec-zfs-classid #1 SMP Tue Sep 17 08:14:20 UTC 2024 x86_64
Software: Apache
PHP version: 7.4.33 [ PHP INFO ] PHP os: Linux
Server Ip: 54.36.31.145
Your Ip: 216.73.216.182
User: homesquasz (91404) | Group: users (100)
Safe Mode: OFF
Disable Function:
_dyuweyrj4,_dyuweyrj4r,dl

name : sync.spec.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const assert = require("assert");
const path = require("path");
const sinon = require("sinon");
const settings_1 = require("../settings");
const tests = require("../tests");
const sync_1 = require("./sync");
class TestReader extends sync_1.default {
    constructor(_root, _settings = new settings_1.default()) {
        super(_root, _settings);
        this._scandir = sinon.stub();
    }
    get scandir() {
        return this._scandir;
    }
}
describe('Readers → Sync', () => {
    describe('.read', () => {
        it('should throw an error when the first call of scandir is broken', () => {
            const reader = new TestReader('non-exist-directory');
            reader.scandir.throws(tests.EPERM_ERRNO);
            assert.throws(() => reader.read(), { code: 'EPERM' });
        });
        it('should return empty array when the first call of scandir is broken but this error can be suppressed', () => {
            const settings = new settings_1.default({
                errorFilter: (error) => error.code === 'EPERM'
            });
            const reader = new TestReader('non-exist-directory', settings);
            reader.scandir.throws(tests.EPERM_ERRNO);
            const actual = reader.read();
            assert.deepStrictEqual(actual, []);
        });
        it('should return entries', () => {
            const reader = new TestReader('directory');
            const fakeDirectoryEntry = tests.buildFakeDirectoryEntry();
            const fakeFileEntry = tests.buildFakeFileEntry();
            reader.scandir.onFirstCall().returns([fakeDirectoryEntry]);
            reader.scandir.onSecondCall().returns([fakeFileEntry]);
            const expected = [fakeDirectoryEntry, fakeFileEntry];
            const actual = reader.read();
            assert.deepStrictEqual(actual, expected);
        });
        it('should push to results only directories', () => {
            const settings = new settings_1.default({ entryFilter: (entry) => !entry.dirent.isFile() });
            const reader = new TestReader('directory', settings);
            const fakeDirectoryEntry = tests.buildFakeDirectoryEntry();
            const fakeFileEntry = tests.buildFakeFileEntry();
            reader.scandir.onFirstCall().returns([fakeDirectoryEntry]);
            reader.scandir.onSecondCall().returns([fakeFileEntry]);
            const expected = [fakeDirectoryEntry];
            const actual = reader.read();
            assert.deepStrictEqual(actual, expected);
        });
        it('should do not read root directory', () => {
            const settings = new settings_1.default({ deepFilter: () => false });
            const reader = new TestReader('directory', settings);
            const fakeDirectoryEntry = tests.buildFakeDirectoryEntry();
            const fakeFileEntry = tests.buildFakeFileEntry();
            reader.scandir.onFirstCall().returns([fakeDirectoryEntry]);
            reader.scandir.onSecondCall().returns([fakeFileEntry]);
            const expected = [fakeDirectoryEntry];
            const actual = reader.read();
            assert.deepStrictEqual(actual, expected);
        });
        it('should set base path to entry when the `basePath` option is exist', () => {
            const settings = new settings_1.default({ basePath: 'base' });
            const reader = new TestReader('directory', settings);
            const fakeDirectoryEntry = tests.buildFakeDirectoryEntry();
            const fakeFileEntry = tests.buildFakeFileEntry();
            reader.scandir.onFirstCall().returns([fakeDirectoryEntry]);
            reader.scandir.onSecondCall().returns([fakeFileEntry]);
            const actual = reader.read();
            assert.strictEqual(actual[0].path, path.join('base', fakeDirectoryEntry.name));
            assert.strictEqual(actual[1].path, path.join('base', 'fake', fakeFileEntry.name));
        });
        it('should set base path to entry when the `basePath` option is exist and value is an empty string', () => {
            const settings = new settings_1.default({ basePath: '' });
            const reader = new TestReader('directory', settings);
            const fakeDirectoryEntry = tests.buildFakeDirectoryEntry();
            const fakeFileEntry = tests.buildFakeFileEntry();
            reader.scandir.onFirstCall().returns([fakeDirectoryEntry]);
            reader.scandir.onSecondCall().returns([fakeFileEntry]);
            const actual = reader.read();
            assert.strictEqual(actual[0].path, fakeDirectoryEntry.name);
            assert.strictEqual(actual[1].path, path.join('fake', fakeFileEntry.name));
        });
    });
});
© 2026 GrazzMean
Page non trouvée – APK Comptoir Hammami
Jannah Theme License is not validated, Go to the theme options page to validate the license, You need a single license for each domain name.

404 :(

Oups ! Cette page est introuvable.

Il semble que nous ne puissions pas trouver ce que vous cherchez. Peut-être qu'une recherche pourrait vous aider.

Bouton retour en haut de la page