Files
js-openstack-lib/test/unit/indexTest.js
Corentin Ardeois bf8deba64e Add functional tests for devstack gate
This patch adds 'functional' tests that will be run by DSVM gate.
A 'cloudsConfig.js' file reads 'clouds.yaml' and converts it to json.
'clouds.yaml' file is searched from the following locations:
 - current directory
 - ~/.config/openstack
 - /etc/openstack
The first file found wins.

For browser, webpack uses a 'yaml' loader and rewrites
'helper/cloudsConfig.js' requirement to 'json!yaml!clouds.yaml'.

A dummy test has been added to demonstrate use of devstack config.

Change-Id: I55909862c70a4cbe22b2820e51c2969d68d8154a
2016-08-05 13:27:17 -04:00

33 lines
639 B
JavaScript

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();
});
});
});