Skip to content

Commit

Permalink
update seed1.bin.processing_expectations format
Browse files Browse the repository at this point in the history
  • Loading branch information
atuchin-m committed Nov 20, 2024
1 parent 37cd0d1 commit 0886bb4
Show file tree
Hide file tree
Showing 2 changed files with 384 additions and 404 deletions.
13 changes: 8 additions & 5 deletions src/finch_tracker/tracker_lib.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,21 @@ import { ItemAction, makeSummary, summaryToJson } from '../core/summary';
import { Study, Study_Channel, Study_Platform } from '../proto/generated/study';
import { VariationsSeed } from '../proto/generated/variations_seed';
import { storeDataToDirectory } from './tracker_lib';
import JSON5 from 'json5';

function readDirectory(dir: string): string {
function readDirectory(dir: string): Record<string, any> {
const files = fs
.readdirSync(dir, { recursive: true, encoding: 'utf-8' })
.sort();
let result = '';
const result: Record<string, string> = {};

for (const file of files) {
const filePath = path.join(dir, file);
if (!file.endsWith('.json5')) {
continue;
}
const content = fs.readFileSync(filePath, 'utf-8');
if (result != '') result += '\n';
result += file + '\n' + content;
result[file] = JSON5.parse(content);
}
return result;
}
Expand All @@ -40,7 +40,10 @@ test('seed serialization', async () => {
isBraveSeed: true,
});

const serializedOutput = readDirectory(path.join(tempDir));
const serializedOutput = JSON5.stringify(
readDirectory(path.join(tempDir)),
{ space: 2 },
);
const serializedExpectations = fs
.readFileSync('src/test/data/seed1.bin.processing_expectations')
.toString();
Expand Down
Loading

0 comments on commit 0886bb4

Please sign in to comment.