packagecloud
Version:
JavaScript API client for packagecloud.io
25 lines (21 loc) • 754 B
JavaScript
import PackageCloud from '../../packagecloud';
const pc = new PackageCloud({token: 'test_token'});
describe("Show Repository Details", () => {
it('should throw an error if repo name is missing in options', () => {
expect(() => {
pc.showRepository({})
}).toThrowError("missing field: repo");
});
it('should throw an error if repo name is malformatted', () => {
expect(() => {
pc.showRepository({repo: "saldo"})
}).toThrowError("The repo field must be in the format: username/reponame");
});
it('should return repository information', () => {
expect.assertions(1);
let resolve = (data) => {
expect(data).toBeDefined();
}
return pc.showRepository({repo: 'test/test'}).then(resolve);
});
})