File: //usr/share/nodejs/fast-glob/out/readers/reader.spec.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const assert = require("assert");
const path = require("path");
const fs_macchiato_1 = require("@nodelib/fs.macchiato");
const settings_1 = require("../settings");
const reader_1 = require("./reader");
class TestReader extends reader_1.default {
constructor(options) {
super(new settings_1.default(options));
}
dynamic() {
return [];
}
static() {
return [];
}
getFullEntryPath(filepath) {
return this._getFullEntryPath(filepath);
}
makeEntry(stats, pattern) {
return this._makeEntry(stats, pattern);
}
}
function getReader(options) {
return new TestReader(options);
}
describe('Readers → Reader', () => {
describe('Constructor', () => {
it('should create instance of class', () => {
const reader = getReader();
assert.ok(reader instanceof TestReader);
});
});
describe('.getFullEntryPath', () => {
it('should return path to entry', () => {
const reader = getReader();
const expected = path.join(process.cwd(), 'config.json');
const actual = reader.getFullEntryPath('config.json');
assert.strictEqual(actual, expected);
});
});
describe('.makeEntry', () => {
it('should return created entry', () => {
const reader = getReader();
const pattern = 'config.json';
const actual = reader.makeEntry(new fs_macchiato_1.Stats(), pattern);
assert.strictEqual(actual.name, pattern);
assert.strictEqual(actual.path, pattern);
assert.ok(actual.dirent.isFile());
});
it('should return created entry with fs.Stats', () => {
const reader = getReader({ stats: true });
const pattern = 'config.json';
const actual = reader.makeEntry(new fs_macchiato_1.Stats(), pattern);
assert.ok(actual.stats);
});
});
});