Reorganize the repo structure (#2503)

Co-authored-by: Francisco Giordano <frangio.1@gmail.com>
This commit is contained in:
Hadrien Croubois
2021-02-22 17:44:16 +01:00
committed by GitHub
parent c3178ff942
commit 24a0bc23cf
174 changed files with 724 additions and 372 deletions

View File

@ -0,0 +1,25 @@
const path = require('path');
const { promises: fs, constants: { F_OK } } = require('fs');
const { expect } = require('chai');
const { pathUpdates, updateImportPaths } = require('../scripts/migrate-imports.js');
describe('migrate-imports.js', function () {
it('every new path exists', async function () {
for (const p of Object.values(pathUpdates)) {
await fs.access(path.join('contracts', p), F_OK);
}
});
it('replaces import paths in a file', async function () {
const source = `
import '@openzeppelin/contracts/math/Math.sol';
import '@openzeppelin/contracts-upgradeable/math/MathUpgradeable.sol';
`;
const expected = `
import '@openzeppelin/contracts/utils/math/Math.sol';
import '@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol';
`;
expect(updateImportPaths(source)).to.equal(expected);
});
});