Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('should accept no options', () => {
const contents = new ContentsManager();
expect(contents).to.be.an.instanceof(ContentsManager);
});
it('should get the url of a file from an additional drive', async () => {
const contents = new ContentsManager();
const other = new Drive({ name: 'other', serverSettings: settings });
contents.addDrive(other);
const test1 = contents.getDownloadUrl('other:bar.txt');
const test2 = contents.getDownloadUrl('other:fizz/buzz/bar.txt');
const test3 = contents.getDownloadUrl('other:/bar.txt');
const urls = await Promise.all([test1, test2, test3]);
expect(urls[0]).to.equal('http://foo/files/bar.txt');
expect(urls[1]).to.equal('http://foo/files/fizz/buzz/bar.txt');
expect(urls[2]).to.equal('http://foo/files/bar.txt');
});
});
it('should get the url of a file from an additional drive', async () => {
const contents = new ContentsManager();
const other = new Drive({ name: 'other', serverSettings: settings });
contents.addDrive(other);
const test1 = contents.getDownloadUrl('other:bar.txt');
const test2 = contents.getDownloadUrl('other:fizz/buzz/bar.txt');
const test3 = contents.getDownloadUrl('other:/bar.txt');
const urls = await Promise.all([test1, test2, test3]);
expect(urls[0]).to.equal('http://foo/files/bar.txt');
expect(urls[1]).to.equal('http://foo/files/fizz/buzz/bar.txt');
expect(urls[2]).to.equal('http://foo/files/bar.txt');
});
});
it('should accept no options', () => {
const contents = new ContentsManager();
expect(contents).to.be.an.instanceof(ContentsManager);
});
it('should get the url of a file', async () => {
const drive = new Drive({ serverSettings: settings });
const contents = new ContentsManager({ defaultDrive: drive });
const test1 = contents.getDownloadUrl('bar.txt');
const test2 = contents.getDownloadUrl('fizz/buzz/bar.txt');
const test3 = contents.getDownloadUrl('/bar.txt');
const urls = await Promise.all([test1, test2, test3]);
expect(urls[0]).to.equal('http://foo/files/bar.txt');
expect(urls[1]).to.equal('http://foo/files/fizz/buzz/bar.txt');
expect(urls[2]).to.equal('http://foo/files/bar.txt');
});
it('should encode characters', async () => {
const drive = new Drive({ serverSettings: settings });
const contents = new ContentsManager({ defaultDrive: drive });
const url = await contents.getDownloadUrl('b ar?3.txt');
expect(url).to.equal('http://foo/files/b%20ar%3F3.txt');
});
beforeEach(() => {
serverSettings = makeSettings();
contents = new ContentsManager({ serverSettings });
});
beforeEach(() => {
contents = new ContentsManager({ serverSettings });
});
beforeEach(() => {
serverSettings = makeSettings();
contents = new ContentsManager({ serverSettings });
});
public async initialize(connInfo: IConnection): Promise {
this.connInfo = connInfo;
this.serverSettings = await this.getServerConnectSettings(connInfo);
this.sessionManager = new SessionManager({ serverSettings: this.serverSettings });
this.contentsManager = new ContentsManager({ serverSettings: this.serverSettings });
}