fix(tests/settings): Improve test assertions and update local settings permissions
This commit is contained in:
@@ -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');
|
||||
|
@@ -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 () => {
|
||||
|
Reference in New Issue
Block a user