UNPKG

@egodigital/egoose

Version:

Helper classes and functions for Node.js 10 or later.

60 lines 2.65 kB
"use strict"; /** * This file is part of the @egodigital/egoose distribution. * Copyright (c) e.GO Digital GmbH, Aachen, Germany (https://www.e-go-digital.com/) * * @egodigital/egoose is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation, version 3. * * @egodigital/egoose is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ Object.defineProperty(exports, "__esModule", { value: true }); const assert = require("assert"); const mocha_1 = require("mocha"); const fs_1 = require("../fs"); mocha_1.describe('#isFile()', async function () { mocha_1.describe('async', async function () { mocha_1.it('script check', async function () { const THAT_FILE = await fs_1.isFile(__filename); const THAT_DIR = await fs_1.isFile(__dirname); assert.equal(THAT_FILE, true); assert.strictEqual(THAT_FILE, true); assert.equal(THAT_DIR, false); assert.strictEqual(THAT_DIR, false); }); mocha_1.it('script check (LSTAT)', async function () { const THAT_FILE = await fs_1.isFile(__filename, true); const THAT_DIR = await fs_1.isFile(__dirname, true); assert.equal(THAT_FILE, true); assert.strictEqual(THAT_FILE, true); assert.equal(THAT_DIR, false); assert.strictEqual(THAT_DIR, false); }); }); mocha_1.describe('sync', async function () { mocha_1.it('script check', function () { const THAT_FILE = fs_1.isFileSync(__filename); const THAT_DIR = fs_1.isFileSync(__dirname); assert.equal(THAT_FILE, true); assert.strictEqual(THAT_FILE, true); assert.equal(THAT_DIR, false); assert.strictEqual(THAT_DIR, false); }); mocha_1.it('script check (LSTAT)', function () { const THAT_FILE = fs_1.isFileSync(__filename, true); const THAT_DIR = fs_1.isFileSync(__dirname, true); assert.equal(THAT_FILE, true); assert.strictEqual(THAT_FILE, true); assert.equal(THAT_DIR, false); assert.strictEqual(THAT_DIR, false); }); }); }); //# sourceMappingURL=isFile.js.map