Skip to content

Commit

Permalink
refactor!: utility module flatting and limiting
Browse files Browse the repository at this point in the history
  • Loading branch information
AuHau committed Aug 18, 2021
1 parent e7f6538 commit a70f4f1
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 10 deletions.
54 changes: 46 additions & 8 deletions src/utils/expose.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,47 @@
export * as Collections from './collection'
export * as Bytes from './bytes'
export * as Data from './data'
export * as File from './file'
export * as Hex from './hex'
export * as Tar from './tar'
export * as Eth from './eth'
export * as Stream from './stream'
export { getCollectionSize, getFolderSize } from './collection'

export {
Bytes,
FlexBytes,
isBytes,
assertBytes,
isFlexBytes,
assertFlexBytes,
bytesAtOffset,
flexBytesAtOffset,
bytesEqual,
} from './bytes'

export {
HexString,
PrefixedHexString,
makeHexString,
hexToBytes,
bytesToHex,
intToHex,
isHexString,
assertHexString,
assertPrefixedHexString,
} from './hex'

export {
EthAddress,
makeEthAddress,
makeHexEthAddress,
isHexEthAddress,
ethToSwarmAddress,
toLittleEndian,
fromLittleEndian,
makeEthereumWalletSigner,
} from './eth'

export {
readableWebToNode,
readableNodeToWeb,
isReadableStream,
isNodeReadable,
normalizeToReadableStream,
isReadable,
} from './stream'

export { keccak256Hash } from './hash'
4 changes: 2 additions & 2 deletions test/unit/utils/collection.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ function createFakeFile(): Partial<File> {

describe('collection', () => {
test('should calculate folder size', async () => {
const size = await Utils.Collections.getFolderSize('./test/data')
const size = await Utils.getFolderSize('./test/data')

expect(size).toBeGreaterThan(1)
})

test('should calculate collection size', async () => {
const files: File[] = [createFakeFile() as File]
const size = Utils.Collections.getCollectionSize(files)
const size = Utils.getCollectionSize(files)

expect(size).toBe(32)
})
Expand Down

0 comments on commit a70f4f1

Please sign in to comment.