diff --git a/libs/remix-url-resolver/tests/test.ts b/libs/remix-url-resolver/tests/test.ts index 1f28ab86d7..24b46c392a 100644 --- a/libs/remix-url-resolver/tests/test.ts +++ b/libs/remix-url-resolver/tests/test.ts @@ -86,6 +86,36 @@ describe('testRunner', () => { }) }) + // Test github import for specific branch + describe('test getting github imports for specific branch', () => { + const urlResolver = new RemixURLResolver() + const fileName: string = 'https://github.com/ethereum/remix-project/blob/remix_beta/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'}) + '\n', + type: 'github' + } + assert.deepEqual(results, expt) + }) + }) + // Test github import for specific tag describe('test getting github imports for specific tag', () => { const urlResolver = new RemixURLResolver()