Merge "Export supported services from index.js"
This commit is contained in:
commit
3221a3513d
12
src/index.js
12
src/index.js
|
@ -1,10 +1,2 @@
|
|||
import 'isomorphic-fetch';
|
||||
|
||||
export default class Test {
|
||||
getUrl (url) {
|
||||
return fetch(url)
|
||||
.then((response) => {
|
||||
return response;
|
||||
});
|
||||
}
|
||||
}
|
||||
export {default as Keystone} from './keystone';
|
||||
export {default as Glance} from './glance';
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
import Test from "../../src/index";
|
||||
import config from "./helpers/cloudsConfig";
|
||||
|
||||
describe("Simple functional test", () => {
|
||||
|
||||
it("should call keystone URL", (done) => {
|
||||
const testKeystone = function(response) {
|
||||
expect(response.status).toBe(200);
|
||||
done();
|
||||
};
|
||||
|
||||
const failTest = function(error) {
|
||||
expect(error).toBeUndefined();
|
||||
done();
|
||||
};
|
||||
|
||||
const t = new Test();
|
||||
t.getUrl(config.clouds.devstack.auth.auth_url + '/v2.0')
|
||||
.then(testKeystone)
|
||||
.catch(failTest);
|
||||
});
|
||||
|
||||
});
|
|
@ -1,32 +0,0 @@
|
|||
import Test from "../../src/index";
|
||||
|
||||
const FetchMock = require('fetch-mock');
|
||||
|
||||
describe("Simple test", () => {
|
||||
|
||||
afterEach(() => {
|
||||
FetchMock.reset();
|
||||
});
|
||||
|
||||
it("should export a class", () => {
|
||||
let t = new Test();
|
||||
expect(t).toBeDefined();
|
||||
});
|
||||
|
||||
it("should retrieve URL's", (done) => {
|
||||
FetchMock.get("http://example.com/", {
|
||||
status: 200,
|
||||
body: "This is a test"
|
||||
});
|
||||
|
||||
let t = new Test();
|
||||
t.getUrl("http://example.com/")
|
||||
.then((response) => {
|
||||
return response.text();
|
||||
})
|
||||
.then((body) => {
|
||||
expect(body).toEqual("This is a test");
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
Loading…
Reference in New Issue