Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions tests/types_index_correct.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
const fs = require('fs');
const path = require('path');
const colors = require('colors');

let failed = false;

const fixturePath = path.join(__dirname, '..', 'fixtures');

// get index
const indexPath = path.join(fixturePath, 'index_types.json');
let index = JSON.parse(fs.readFileSync(indexPath, 'utf8'));
console.log('Parsing types index file ' + indexPath);


// reverse `f(type) -> fixtures` to `f(fixture) -> type`
// (mathematical notation)
const fixtureTypes = {};
for (const type in index) {
for (const fixture of index[type]) {
if (fixtureTypes[fixture] === undefined) {
fixtureTypes[fixture] = [type];
}
else {
fixtureTypes[fixture].push(type);
}
}
}
console.log(fixtureTypes);