From 88e886f4357bf62dfb8ea6894257da1347507213 Mon Sep 17 00:00:00 2001 From: saul Date: Wed, 27 Mar 2024 10:16:04 +1300 Subject: [PATCH] Cleanup daemon tests. --- packages/daemon/test-data/dir-1/file-3.txt | 1 - packages/daemon/test-data/file-1.txt | 1 - packages/daemon/test-data/file-2.txt | 7 ------ .../daemon/test/modules/filesystem.spec.ts | 22 +++---------------- .../daemon/test/modules/revisions.spec.ts | 22 +++++-------------- 5 files changed, 8 insertions(+), 45 deletions(-) delete mode 100644 packages/daemon/test-data/dir-1/file-3.txt delete mode 100644 packages/daemon/test-data/file-1.txt delete mode 100644 packages/daemon/test-data/file-2.txt diff --git a/packages/daemon/test-data/dir-1/file-3.txt b/packages/daemon/test-data/dir-1/file-3.txt deleted file mode 100644 index 2fe6575e..00000000 --- a/packages/daemon/test-data/dir-1/file-3.txt +++ /dev/null @@ -1 +0,0 @@ -The quick brown fox jumps over the lazy dog. diff --git a/packages/daemon/test-data/file-1.txt b/packages/daemon/test-data/file-1.txt deleted file mode 100644 index cee7a927..00000000 --- a/packages/daemon/test-data/file-1.txt +++ /dev/null @@ -1 +0,0 @@ -Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. diff --git a/packages/daemon/test-data/file-2.txt b/packages/daemon/test-data/file-2.txt deleted file mode 100644 index f0371b35..00000000 --- a/packages/daemon/test-data/file-2.txt +++ /dev/null @@ -1,7 +0,0 @@ -Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. - -Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. - -Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. - -Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. diff --git a/packages/daemon/test/modules/filesystem.spec.ts b/packages/daemon/test/modules/filesystem.spec.ts index f77fa37c..9ea9ffcd 100644 --- a/packages/daemon/test/modules/filesystem.spec.ts +++ b/packages/daemon/test/modules/filesystem.spec.ts @@ -2,7 +2,7 @@ import assert from 'assert/strict' import fs from 'fs/promises' import Path from 'path' import { unixfs } from '@helia/unixfs' -import { importer, selectChunker } from '@organicdesign/db-fs-importer' +import { importer } from '@organicdesign/db-fs-importer' import { KeyManager } from '@organicdesign/db-key-manager' import * as testData from '@organicdesign/db-test-data' import { createNetClient } from '@organicdesign/net-rpc' @@ -308,20 +308,12 @@ describe('filesystem', () => { const group = await createGroup(groups, 'test') const fs = m.getFileSystem(group) const rootPath = '/test' - const chunker = selectChunker() const outPath = Path.join(testPath, 'export-file') assert(fs != null) await Promise.all(testData.data.map(async data => { - const result = await all(importer( - network.helia.blockstore, - data.path, - { - chunker, - cidVersion: 1 - } - )) + const result = await all(importer(network.helia.blockstore, data.path)) await m.uploads.add('put', [group.bytes, data.generatePath(rootPath), { cid: result[0].cid.bytes, @@ -356,20 +348,12 @@ describe('filesystem', () => { const group = await createGroup(groups, 'test') const fs = m.getFileSystem(group) const rootPath = '/test' - const chunker = selectChunker() const outPath = Path.join(testPath, 'export-directory') assert(fs != null) await Promise.all(testData.data.map(async data => { - const result = await all(importer( - network.helia.blockstore, - data.path, - { - chunker, - cidVersion: 1 - } - )) + const result = await all(importer(network.helia.blockstore, data.path)) await m.uploads.add('put', [group.bytes, data.generatePath(rootPath), { cid: result[0].cid.bytes, diff --git a/packages/daemon/test/modules/revisions.spec.ts b/packages/daemon/test/modules/revisions.spec.ts index fce03ff1..bb367334 100644 --- a/packages/daemon/test/modules/revisions.spec.ts +++ b/packages/daemon/test/modules/revisions.spec.ts @@ -2,7 +2,7 @@ import assert from 'assert' import fs from 'fs/promises' import Path from 'path' import { unixfs } from '@helia/unixfs' -import { importer, selectChunker } from '@organicdesign/db-fs-importer' +import { importer } from '@organicdesign/db-fs-importer' import { KeyManager } from '@organicdesign/db-key-manager' import * as testData from '@organicdesign/db-test-data' import { createNetClient } from '@organicdesign/net-rpc' @@ -198,10 +198,7 @@ describe('revisions', () => { assert(fs != null) - const [{ cid }] = await all(importer(network.helia.blockstore, dataFile.path, { - cidVersion: 1, - chunker: selectChunker() - })) + const [{ cid }] = await all(importer(network.helia.blockstore, dataFile.path)) const promise = new Promise((resolve, reject) => { setTimeout(() => { reject(new Error('timeout')) }, 100) @@ -251,10 +248,7 @@ describe('revisions', () => { for (const dataFile of testData.data) { const virtualPath = dataFile.generatePath(rootPath) - const [{ cid }] = await all(importer(network.helia.blockstore, dataFile.path, { - cidVersion: 1, - chunker: selectChunker() - })) + const [{ cid }] = await all(importer(network.helia.blockstore, dataFile.path)) const promise = new Promise((resolve, reject) => { setTimeout(() => { reject(new Error('timeout')) }, 100) @@ -304,10 +298,7 @@ describe('revisions', () => { assert(fs != null) - const [{ cid }] = await all(importer(network.helia.blockstore, dataFile.path, { - cidVersion: 1, - chunker: selectChunker() - })) + const [{ cid }] = await all(importer(network.helia.blockstore, dataFile.path)) const promise = new Promise((resolve, reject) => { setTimeout(() => { reject(new Error('timeout')) }, 100) @@ -363,10 +354,7 @@ describe('revisions', () => { for (const dataFile of testData.data) { const virtualPath = dataFile.generatePath(rootPath) - const [{ cid }] = await all(importer(network.helia.blockstore, dataFile.path, { - cidVersion: 1, - chunker: selectChunker() - })) + const [{ cid }] = await all(importer(network.helia.blockstore, dataFile.path)) const promise = new Promise((resolve, reject) => { setTimeout(() => { reject(new Error('timeout')) }, 100)