Added directory/file exists
This commit is contained in:
@@ -102,6 +102,8 @@ test('can create and remove a directory using api', async () => {
|
||||
);
|
||||
const api = repertory.create_api(conn);
|
||||
expect(await api.directory.create('/repertory_js')).toEqual(0);
|
||||
expect(await api.directory.exists('/repertory_js')).toEqual(true);
|
||||
expect(await api.file.exists('/repertory_js')).toEqual(false);
|
||||
expect(await api.directory.remove('/repertory_js')).toEqual(0);
|
||||
|
||||
await conn.disconnect();
|
||||
@@ -278,6 +280,8 @@ test('can upload and download a file using api', async () => {
|
||||
await calculate_sha256('repertory_test.dat')
|
||||
);
|
||||
|
||||
expect(await api.directory.exists('/repertory_test.dat')).toEqual(false);
|
||||
expect(await api.file.exists('/repertory_test.dat')).toEqual(true);
|
||||
expect(await api.file.delete('/repertory_test.dat')).toEqual(0);
|
||||
fs.unlinkSync('repertory_test.dat');
|
||||
|
||||
@@ -518,3 +522,27 @@ test('can resume upload using api', async () => {
|
||||
|
||||
await conn.disconnect();
|
||||
}, 60000);
|
||||
|
||||
test('exists returns false if directory is not found', async () => {
|
||||
const conn = await repertory.create_pool(
|
||||
2,
|
||||
TEST_HOST,
|
||||
TEST_PORT,
|
||||
TEST_PASSWORD
|
||||
);
|
||||
const api = repertory.create_api(conn);
|
||||
expect(await api.directory.exists('/cow')).toEqual(false);
|
||||
await conn.disconnect();
|
||||
});
|
||||
|
||||
test('exists returns false if file is not found', async () => {
|
||||
const conn = await repertory.create_pool(
|
||||
2,
|
||||
TEST_HOST,
|
||||
TEST_PORT,
|
||||
TEST_PASSWORD
|
||||
);
|
||||
const api = repertory.create_api(conn);
|
||||
expect(await api.file.exists('/cow')).toEqual(false);
|
||||
await conn.disconnect();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user