Export supported services from index.js
This is required to make services provided by library accessible this way: import {Keystone} from 'openstack-lib'; instead of import Keystone from 'openstack-lib/dist/keystone'; Also, Test class and dummy functional and unit tests for it were removed since they aren't needed anymore. Change-Id: I6bf0b6eebab095d6585d19d8398d9f2ac119cacc
This commit is contained in:
parent
b60cb86755
commit
c2164e8b15
12
src/index.js
12
src/index.js
|
@ -1,10 +1,2 @@
|
||||||
import 'isomorphic-fetch';
|
export {default as Keystone} from './keystone';
|
||||||
|
export {default as Glance} from './glance';
|
||||||
export default class Test {
|
|
||||||
getUrl (url) {
|
|
||||||
return fetch(url)
|
|
||||||
.then((response) => {
|
|
||||||
return response;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -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