kopia lustrzana https://gitlab.com/rysiekpl/libresilient
any-of: test added for erroring out when no wrapped plugins configured (ref. #21)
rodzic
a797cd697a
commit
ffe2b2c40c
|
@ -83,7 +83,23 @@ describe("plugin: any-of", () => {
|
|||
expect(LibResilientPluginConstructors.get('any-of')(LR, init).name).toEqual('any-of');
|
||||
});
|
||||
|
||||
test("it should return data from fetch()", async () => {
|
||||
test("it should throw an error when there aren't any wrapped plugins configured", async () => {
|
||||
require("../../plugins/any-of.js");
|
||||
init = {
|
||||
name: 'any-of',
|
||||
uses: []
|
||||
}
|
||||
|
||||
expect.assertions(2);
|
||||
try {
|
||||
await LibResilientPluginConstructors.get('any-of')(LR, init).fetch('https://resilient.is/test.json')
|
||||
} catch (e) {
|
||||
expect(e).toBeInstanceOf(Error)
|
||||
expect(e.toString()).toMatch('No wrapped plugins configured!')
|
||||
}
|
||||
});
|
||||
|
||||
test("it should return data from a wrapped plugin", async () => {
|
||||
require("../../plugins/any-of.js");
|
||||
|
||||
const response = await LibResilientPluginConstructors.get('any-of')(LR, init).fetch('https://resilient.is/test.json');
|
||||
|
@ -93,7 +109,7 @@ describe("plugin: any-of", () => {
|
|||
expect(response.url).toEqual('https://resilient.is/test.json')
|
||||
});
|
||||
|
||||
test("it should return data from fetch()", async () => {
|
||||
test("it should pass Request() init data onto wrapped plugins", async () => {
|
||||
require("../../plugins/any-of.js");
|
||||
|
||||
var initTest = {
|
||||
|
|
Ładowanie…
Reference in New Issue