added directory snapshot
This commit is contained in:
@@ -91,12 +91,12 @@ test('can create and remove a directory using api', async () => {
|
||||
await conn.disconnect();
|
||||
});
|
||||
|
||||
test('can get directory list using api', async () => {
|
||||
test('can get directory list and snapshot using api', async () => {
|
||||
const conn =
|
||||
await repertory.create_pool(2, TEST_HOST, TEST_PORT, TEST_PASSWORD);
|
||||
await repertory.create_pool(2, TEST_HOST, TEST_PORT, TEST_PASSWORD);
|
||||
const api = repertory.create_api(conn);
|
||||
await api.directory.list('/', async (remote_path, page_count, get_page) => {
|
||||
console.log(remote_path, page_count, get_page);
|
||||
|
||||
const test_results = async (remote_path, page_count, get_page) => {
|
||||
expect(remote_path).toEqual('/');
|
||||
expect(page_count).toBeGreaterThanOrEqual(1);
|
||||
expect(get_page).toBeInstanceOf(Function);
|
||||
@@ -110,8 +110,23 @@ test('can get directory list using api', async () => {
|
||||
expect(items[1].directory).toBeTruthy();
|
||||
expect(items[1].path).toEqual('..');
|
||||
}
|
||||
};
|
||||
|
||||
await api.directory.list('/', async (remote_path, page_count, get_page) => {
|
||||
console.log(remote_path, page_count, get_page);
|
||||
await test_results(remote_path, page_count, get_page);
|
||||
});
|
||||
|
||||
const snap = await api.directory.snapshot('/');
|
||||
try {
|
||||
console.log(snap.remote_path, snap.page_count, snap.get_page);
|
||||
await test_results(snap.remote_path, snap.page_count, snap.get_page);
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
} finally {
|
||||
await snap.release();
|
||||
}
|
||||
|
||||
await conn.disconnect();
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user