|
| 1 | +import { MantarayNode } from '../../src' |
| 2 | +import { arbitraryReference, batch, makeBee } from '../utils' |
| 3 | + |
| 4 | +test('should not throw Bytes#checkByteLength', async () => { |
| 5 | + const bee = makeBee() |
| 6 | + |
| 7 | + const paths = [ |
| 8 | + 'c/grants/index.xml', |
| 9 | + 'c/grants/index.html', |
| 10 | + 'c/ecosystem/index.xml', |
| 11 | + 'c/ecosystem/index.html', |
| 12 | + 'c/development-updates/index.xml', |
| 13 | + 'c/development-updates/index.html', |
| 14 | + 'c/events/index.xml', |
| 15 | + 'c/events/index.html', |
| 16 | + 'c/tutorials/index.xml', |
| 17 | + 'c/tutorials/index.html', |
| 18 | + 'css/main.bundle.min.4e55be0357e7dec25cf1bea80877847773ee67f75d09281900b7bd8c8d07b4cded5555fb3b9c01a3826e021712d0fd63866586c0aa832ebb86de60c217a2f288.css', |
| 19 | + ] |
| 20 | + |
| 21 | + const manifest = new MantarayNode() |
| 22 | + for (const path of paths) { |
| 23 | + manifest.addFork(path, arbitraryReference()) |
| 24 | + } |
| 25 | + |
| 26 | + const result = await manifest.saveRecursively(bee, batch()) |
| 27 | + |
| 28 | + const unmarshaled = await MantarayNode.unmarshal(bee, result.reference) |
| 29 | + await unmarshaled.loadRecursively(bee) |
| 30 | + |
| 31 | + const items = unmarshaled.collectAndMap() |
| 32 | + expect(Object.keys(items).length).toBe(paths.length) |
| 33 | +}) |
| 34 | + |
| 35 | +test('should not throw SyntaxError', async () => { |
| 36 | + const bee = makeBee() |
| 37 | + |
| 38 | + const paths = [ |
| 39 | + 'c/ecosystem/index.xml', |
| 40 | + 'c/ecosystem/index.html', |
| 41 | + 'c/development-updates/index.xml', |
| 42 | + 'c/development-updates/index.html', |
| 43 | + 'c/events/index.xml', |
| 44 | + 'c/events/index.html', |
| 45 | + 'css/main.bundle.min.4e55be0357e7dec25cf1bea80877847773ee67f75d09281900b7bd8c8d07b4cded5555fb3b9c01a3826e021712d0fd63866586c0aa832ebb86de60c217a2f288.css', |
| 46 | + ] |
| 47 | + |
| 48 | + const manifest = new MantarayNode() |
| 49 | + for (const path of paths) { |
| 50 | + manifest.addFork(path, arbitraryReference()) |
| 51 | + } |
| 52 | + |
| 53 | + const result = await manifest.saveRecursively(bee, batch()) |
| 54 | + |
| 55 | + const unmarshaled = await MantarayNode.unmarshal(bee, result.reference) |
| 56 | + await unmarshaled.loadRecursively(bee) |
| 57 | + |
| 58 | + const items = unmarshaled.collectAndMap() |
| 59 | + expect(Object.keys(items).length).toBe(paths.length) |
| 60 | +}) |
0 commit comments