Skip to content

Commit

Permalink
Cleanup daemon tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
saul-jb committed Mar 26, 2024
1 parent d1ae5cc commit 88e886f
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 45 deletions.
1 change: 0 additions & 1 deletion packages/daemon/test-data/dir-1/file-3.txt

This file was deleted.

1 change: 0 additions & 1 deletion packages/daemon/test-data/file-1.txt

This file was deleted.

7 changes: 0 additions & 7 deletions packages/daemon/test-data/file-2.txt

This file was deleted.

22 changes: 3 additions & 19 deletions packages/daemon/test/modules/filesystem.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
22 changes: 5 additions & 17 deletions packages/daemon/test/modules/revisions.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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<void>((resolve, reject) => {
setTimeout(() => { reject(new Error('timeout')) }, 100)
Expand Down Expand Up @@ -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<void>((resolve, reject) => {
setTimeout(() => { reject(new Error('timeout')) }, 100)
Expand Down Expand Up @@ -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<void>((resolve, reject) => {
setTimeout(() => { reject(new Error('timeout')) }, 100)
Expand Down Expand Up @@ -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<void>((resolve, reject) => {
setTimeout(() => { reject(new Error('timeout')) }, 100)
Expand Down

0 comments on commit 88e886f

Please sign in to comment.