Browse Source

Update context test

Steven Silvester 8 years ago
parent
commit
ac0c0da34e
1 changed files with 22 additions and 5 deletions
  1. 22 5
      test/src/docregistry/context.spec.ts

+ 22 - 5
test/src/docregistry/context.spec.ts

@@ -388,17 +388,34 @@ describe('docregistry/context', () => {
     describe('#resolveUrl()', () => {
     describe('#resolveUrl()', () => {
 
 
       it('should resolve a relative url to a correct server path', (done) => {
       it('should resolve a relative url to a correct server path', (done) => {
-        let resolveUrlPromise = context.resolveUrl('./foo');
-        let getDownloadUrlPromise = manager.contents.getDownloadUrl('foo');
-        Promise.all([resolveUrlPromise, getDownloadUrlPromise])
-        .then((values)=>{
+        context.resolve('./foo').then(path => {
+          expect(path).to.be('foo');
+        }).then(done, done);
+      });
+
+      it('should ignore urls that have a protocol', (done) => {
+        context.resolveUrl('http://foo').then(path => {
+          expect(path).to.be('http://foo');
+          done();
+        }).catch(done);
+      });
+
+    });
+
+    describe('#getDownloadUrl()', () => {
+
+      it('should resolve an absolute server url to a download url', (done) => {
+        let contextPromise = context.getDownloadUrl('foo');
+        let contentsPromise = manager.contents.getDownloadUrl('foo');
+        Promise.all([contextPromise, contentsPromise])
+        .then(values => {
           expect(values[0]).to.be(values[1]);
           expect(values[0]).to.be(values[1]);
           done();
           done();
         }).catch(done);
         }).catch(done);
       });
       });
 
 
       it('should ignore urls that have a protocol', (done) => {
       it('should ignore urls that have a protocol', (done) => {
-        context.resolveUrl('http://foo').then((path)=>{
+        context.getDownloadUrl('http://foo').then(path => {
           expect(path).to.be('http://foo');
           expect(path).to.be('http://foo');
           done();
           done();
         }).catch(done);
         }).catch(done);