fix(tests/settings): Improve test assertions and update local settings permissions
This commit is contained in:
@@ -1,5 +1,12 @@
|
|||||||
# Changelog
|
# 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)
|
## 2025-05-21 - 11.2.1 - fix(fs)
|
||||||
Fix inconsistent glob matching in listFileTree and update test imports and dependency versions for enhanced stability.
|
Fix inconsistent glob matching in listFileTree and update test imports and dependency versions for enhanced stability.
|
||||||
|
|
||||||
|
@@ -57,7 +57,7 @@ tap.test('StreamFile should return content as a buffer', async () => {
|
|||||||
tap.test('StreamFile should return content as a string', async () => {
|
tap.test('StreamFile should return content as a string', async () => {
|
||||||
const streamFile = await smartfile.StreamFile.fromPath(path.join(testAssetsPath, 'mytest.json'));
|
const streamFile = await smartfile.StreamFile.fromPath(path.join(testAssetsPath, 'mytest.json'));
|
||||||
const contentString = await streamFile.getContentAsString();
|
const contentString = await streamFile.getContentAsString();
|
||||||
expect(typeof contentString).toBeTypeofString();
|
expect(contentString).toBeTypeofString();
|
||||||
// Verify the content matches what's expected
|
// Verify the content matches what's expected
|
||||||
// This assumes the file contains a JSON object with a key 'key1' with value 'this works'
|
// This assumes the file contains a JSON object with a key 'key1' with value 'this works'
|
||||||
expect(JSON.parse(contentString).key1).toEqual('this works');
|
expect(JSON.parse(contentString).key1).toEqual('this works');
|
||||||
|
@@ -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 () => {
|
tap.test('.fs.fileExists -> should resolve or reject a promise', async () => {
|
||||||
expect(smartfile.fs.fileExists('./test/testassets/mytest.json')).toBeInstanceOf(Promise);
|
await expect(smartfile.fs.fileExists('./test/testassets/mytest.json')).resolves.toBeTrue();
|
||||||
await smartfile.fs.fileExists('./test/testassets/mytest.json');
|
await expect(smartfile.fs.fileExists('./test/testassets/notthere.json')).resolves.toBeFalse();
|
||||||
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'"
|
|
||||||
);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
tap.test('.fs.listFoldersSync() -> should get the file type from a string', async () => {
|
tap.test('.fs.listFoldersSync() -> should get the file type from a string', async () => {
|
||||||
|
@@ -3,6 +3,6 @@
|
|||||||
*/
|
*/
|
||||||
export const commitinfo = {
|
export const commitinfo = {
|
||||||
name: '@push.rocks/smartfile',
|
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.'
|
description: 'Provides comprehensive tools for efficient file management in Node.js using TypeScript, including handling streams, virtual directories, and various file operations.'
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user