diff --git a/libs/remix-url-resolver/tests/test.ts b/libs/remix-url-resolver/tests/test.ts index ca4ba0e7a5..1f28ab86d7 100644 --- a/libs/remix-url-resolver/tests/test.ts +++ b/libs/remix-url-resolver/tests/test.ts @@ -86,8 +86,8 @@ describe('testRunner', () => { }) }) - // Test github import for specific blob - describe('test getting github imports for specific blob', () => { + // Test github import for specific tag + describe('test getting github imports for specific tag', () => { const urlResolver = new RemixURLResolver() const fileName: string = 'https://github.com/ethereum/remix-project/blob/v0.10.7/libs/remix-url-resolver/tests/example_1/greeter.sol' let results: object = {} @@ -116,6 +116,36 @@ describe('testRunner', () => { }) }) + // Test github import for specific commit id + describe('test getting github imports for specific commit id', () => { + const urlResolver = new RemixURLResolver() + const fileName: string = 'https://github.com/ethereum/remix-project/blob/d95b20d77bb3d41da4a86f3ff486879edb386a5b/libs/remix-url-resolver/tests/example_1/greeter.sol' + let results: object = {} + + before(done => { + urlResolver.resolve(fileName) + .then((sources: object) => { + results = sources + done() + }) + .catch((e: Error) => { + throw e + }) + }) + + it('should have 3 items', () => { + assert.equal(Object.keys(results).length, 3) + }) + it('should return contract content of given github path', () => { + const expt: object = { + cleanUrl: 'ethereum/remix-project/libs/remix-url-resolver/tests/example_1/greeter.sol', + content: fs.readFileSync(__dirname + '/example_1/greeter.sol', { encoding: 'utf8'}), + type: 'github' + } + assert.deepEqual(results, expt) + }) + }) + // Test https imports describe('test getting https imports', () => { const urlResolver = new RemixURLResolver()