update
This commit is contained in:
0
test/test.streamfile.ts
Normal file
0
test/test.streamfile.ts
Normal file
10
test/test.ts
10
test/test.ts
@ -64,7 +64,7 @@ tap.test('.fs.fileTreeToObject -> should read a file tree into an Object', async
|
||||
path.resolve('./test/testassets/'),
|
||||
'**/*.txt'
|
||||
);
|
||||
expect(fileArrayArg[0]).toBeInstanceOf(smartfile.Smartfile);
|
||||
expect(fileArrayArg[0]).toBeInstanceOf(smartfile.SmartFile);
|
||||
expect(fileArrayArg[0].contents.toString()).toEqual(fileArrayArg[0].contentBuffer.toString());
|
||||
});
|
||||
|
||||
@ -175,7 +175,7 @@ tap.test('.Smartfile -> should produce vinyl compatible files', async () => {
|
||||
'./test/testassets/testfolder/**/*'
|
||||
);
|
||||
const localSmartfile = smartfileArray[0];
|
||||
expect(localSmartfile).toBeInstanceOf(smartfile.Smartfile);
|
||||
expect(localSmartfile).toBeInstanceOf(smartfile.SmartFile);
|
||||
expect(localSmartfile.contents).toBeInstanceOf(Buffer);
|
||||
// tslint:disable-next-line:no-unused-expression
|
||||
expect(localSmartfile.isBuffer()).toBeTrue();
|
||||
@ -202,9 +202,9 @@ tap.test('should output a smartfile array to disk', async () => {
|
||||
tap.test('should create, store and retrieve valid smartfiles', async () => {
|
||||
const fileString = 'hi there';
|
||||
const filePath = './test/testassets/utf8.txt';
|
||||
const smartfileInstance = await smartfile.Smartfile.fromString(filePath, fileString, 'utf8');
|
||||
const smartfileInstance = await smartfile.SmartFile.fromString(filePath, fileString, 'utf8');
|
||||
smartfileInstance.write();
|
||||
const smartfileInstance2 = await smartfile.Smartfile.fromFilePath(filePath);
|
||||
const smartfileInstance2 = await smartfile.SmartFile.fromFilePath(filePath);
|
||||
const retrievedString = smartfileInstance.contents.toString();
|
||||
expect(retrievedString).toEqual(fileString);
|
||||
});
|
||||
@ -212,7 +212,7 @@ tap.test('should create, store and retrieve valid smartfiles', async () => {
|
||||
tap.test('should get a hash', async () => {
|
||||
const fileString = 'hi there';
|
||||
const filePath = './test/testassets/utf8.txt';
|
||||
const smartfileInstance = await smartfile.Smartfile.fromString(filePath, fileString, 'utf8');
|
||||
const smartfileInstance = await smartfile.SmartFile.fromString(filePath, fileString, 'utf8');
|
||||
const hash = await smartfileInstance.getHash();
|
||||
console.log(hash);
|
||||
});
|
||||
|
Reference in New Issue
Block a user