1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import { parseKeepManifestText } from "./collection-manifest-parser";
6 import { mapManifestToFiles, mapManifestToDirectories, mapManifestToCollectionFilesTree, mapCollectionFilesTreeToManifest } from "./collection-manifest-mapper";
8 test('mapManifestToFiles', () => {
9 const manifestText = `. 930625b054ce894ac40596c3f5a0d947+33 0:0:a 0:0:b 0:33:output.txt\n./c d41d8cd98f00b204e9800998ecf8427e+0 0:0:d`;
10 const manifest = parseKeepManifestText(manifestText);
11 const files = mapManifestToFiles(manifest);
12 expect(files).toEqual([{
43 test('mapManifestToDirectories', () => {
44 const manifestText = `./c/user/results 930625b054ce894ac40596c3f5a0d947+33 0:0:a 0:0:b 0:33:output.txt\n`;
45 const manifest = parseKeepManifestText(manifestText);
46 const directories = mapManifestToDirectories(manifest);
47 expect(directories).toEqual([{
61 id: '/c/user/results',
68 test('mapCollectionFilesTreeToManifest', () => {
69 const manifestText = `. 930625b054ce894ac40596c3f5a0d947+33 0:22:test.txt\n./c/user/results 930625b054ce894ac40596c3f5a0d947+33 0:0:a 0:0:b 0:33:output.txt\n`;
70 const tree = mapManifestToCollectionFilesTree(parseKeepManifestText(manifestText));
71 const manifest = mapCollectionFilesTreeToManifest(tree);
72 expect(manifest).toEqual([{
81 name: '/c/user/results',