Compare commits

...

3 Commits

Author SHA1 Message Date
3988ccbcb3 11.2.3 2025-05-21 13:27:10 +00:00
6eadbc654f 11.2.2 2025-05-21 13:26:29 +00:00
fda1543701 fix(tests/settings): Improve test assertions and update local settings permissions 2025-05-21 13:26:29 +00:00
5 changed files with 12 additions and 10 deletions

View File

@@ -1,5 +1,12 @@
# Changelog
## 2025-05-21 - 11.2.2 - fix(tests/settings)
Improve test assertions and update local settings permissions
- Refactor StreamFile tests to assert content string type using toBeTypeofString
- Update file existence tests to use resolves.toBeTrue and resolves.toBeFalse for cleaner promise handling
- Add .claude/settings.local.json to allow specific Bash permissions for pnpm test commands
## 2025-05-21 - 11.2.1 - fix(fs)
Fix inconsistent glob matching in listFileTree and update test imports and dependency versions for enhanced stability.

View File

@@ -1,7 +1,7 @@
{
"name": "@push.rocks/smartfile",
"private": false,
"version": "11.2.1",
"version": "11.2.3",
"description": "Provides comprehensive tools for efficient file management in Node.js using TypeScript, including handling streams, virtual directories, and various file operations.",
"main": "dist_ts/index.js",
"typings": "dist_ts/index.d.ts",

View File

@@ -57,7 +57,7 @@ tap.test('StreamFile should return content as a buffer', async () => {
tap.test('StreamFile should return content as a string', async () => {
const streamFile = await smartfile.StreamFile.fromPath(path.join(testAssetsPath, 'mytest.json'));
const contentString = await streamFile.getContentAsString();
expect(typeof contentString).toBeTypeofString();
expect(contentString).toBeTypeofString();
// Verify the content matches what's expected
// This assumes the file contains a JSON object with a key 'key1' with value 'this works'
expect(JSON.parse(contentString).key1).toEqual('this works');

View File

@@ -15,13 +15,8 @@ tap.test('.fs.fileExistsSync -> should return an accurate boolean', async () =>
});
tap.test('.fs.fileExists -> should resolve or reject a promise', async () => {
expect(smartfile.fs.fileExists('./test/testassets/mytest.json')).toBeInstanceOf(Promise);
await smartfile.fs.fileExists('./test/testassets/mytest.json');
await smartfile.fs.fileExists('./test/testassets/notthere.json').catch((err) => {
return expect(err.message).toEqual(
"ENOENT: no such file or directory, access './test/testassets/notthere.json'"
);
});
await expect(smartfile.fs.fileExists('./test/testassets/mytest.json')).resolves.toBeTrue();
await expect(smartfile.fs.fileExists('./test/testassets/notthere.json')).resolves.toBeFalse();
});
tap.test('.fs.listFoldersSync() -> should get the file type from a string', async () => {

View File

@@ -3,6 +3,6 @@
*/
export const commitinfo = {
name: '@push.rocks/smartfile',
version: '11.2.1',
version: '11.2.2',
description: 'Provides comprehensive tools for efficient file management in Node.js using TypeScript, including handling streams, virtual directories, and various file operations.'
}