Skip to content

Commit 2b41e78

Browse files
authored
test: improve decrypted manifest unmarshal test (#1064)
1 parent 5dd7e10 commit 2b41e78

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed
Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
1+
import { createReadStream } from 'fs'
2+
import { readFile } from 'fs/promises'
13
import { MantarayNode } from '../../src'
2-
import { makeBee } from '../utils'
4+
import { batch, makeBee } from '../utils'
35

46
test('decrypt a manifest that is encrypted and obfuscated', async () => {
57
const bee = makeBee()
6-
const reference =
7-
'2874296904931ffea2ae85c7a2646756e2c475d5d5983c14c1002a510a4a3ca0b53ee9d62fd060b58cab6b47d3f26b4f3f3c614c74bd689af2bfa756d80152ca'
88

9-
const node = await MantarayNode.unmarshal(bee, reference)
9+
const result = await bee.uploadFile(batch(), createReadStream('.editorconfig'), '.editorconfig', { encrypt: true })
10+
11+
const node = await MantarayNode.unmarshal(bee, result.reference)
1012
await node.loadRecursively(bee)
1113

1214
const items = node.collectAndMap()
13-
expect(items['.editorconfig']).toBe(
14-
'ef7b55dd0059af17c861e4b7b81b62d32d131b510eae1f21e8b550f864305ebca4546334599af9a91052cc183216e336e9fc815ebc3f7fc8cc88004a5e81f426',
15-
)
15+
expect(items['.editorconfig']).toBeDefined()
16+
17+
const data = await bee.downloadData(items['.editorconfig'])
18+
expect(data.toUtf8()).toEqual(await readFile('.editorconfig', 'utf-8'))
1619
})

0 commit comments

Comments
 (0)