test github imports for branch

pull/5370/head
aniket-engg 4 years ago committed by Aniket
parent aef63d518c
commit 39239ffd33
  1. 30
      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()

Loading…
Cancel
Save