Fixed incorrectly implemented tests for loadOptions (#12301)
This commit is contained in:
parent
ad8a4d62fd
commit
21f42544ca
@ -62,7 +62,7 @@ describe("option-manager", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("should not throw when a preset string followed by valid preset object", () => {
|
it("should not throw when a preset string followed by valid preset object", () => {
|
||||||
const { plugin } = makePlugin("my-plugin");
|
const { plugin } = makePlugin();
|
||||||
expect(
|
expect(
|
||||||
loadOptions({
|
loadOptions({
|
||||||
presets: [
|
presets: [
|
||||||
@ -73,8 +73,8 @@ describe("option-manager", () => {
|
|||||||
).toBeTruthy();
|
).toBeTruthy();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should throw if a plugin is repeated, with information about the repeated plugin", () => {
|
it("should throw if a plugin name is repeated, with information about the repeated plugin", () => {
|
||||||
const { calls, plugin } = makePlugin("my-plugin");
|
const { calls, plugin } = makePlugin();
|
||||||
|
|
||||||
expect(() => {
|
expect(() => {
|
||||||
loadOptions({
|
loadOptions({
|
||||||
@ -101,17 +101,15 @@ describe("option-manager", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("should not throw if a repeated plugin has a different name", () => {
|
it("should not throw if a repeated plugin has a different name", () => {
|
||||||
const { calls: calls1, plugin: plugin1 } = makePlugin();
|
const { calls, plugin } = makePlugin();
|
||||||
const { calls: calls2, plugin: plugin2 } = makePlugin();
|
|
||||||
|
|
||||||
loadOptions({
|
loadOptions({
|
||||||
plugins: [
|
plugins: [
|
||||||
[plugin1, { arg: 1 }],
|
[plugin, { arg: 1 }],
|
||||||
[plugin2, { arg: 2 }, "some-name"],
|
[plugin, { arg: 2 }, "some-name"],
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
expect(calls1).toEqual([{ arg: 1 }]);
|
expect(calls).toEqual([{ arg: 1 }, { arg: 2 }]);
|
||||||
expect(calls2).toEqual([{ arg: 2 }]);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should merge .env[] plugins with parent presets", () => {
|
it("should merge .env[] plugins with parent presets", () => {
|
||||||
@ -146,17 +144,15 @@ describe("option-manager", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("should not throw if a repeated preset has a different name", () => {
|
it("should not throw if a repeated preset has a different name", () => {
|
||||||
const { calls: calls1, plugin: preset1 } = makePlugin();
|
const { calls, plugin: preset } = makePlugin();
|
||||||
const { calls: calls2, plugin: preset2 } = makePlugin();
|
|
||||||
|
|
||||||
loadOptions({
|
loadOptions({
|
||||||
presets: [
|
presets: [
|
||||||
[preset1, { arg: 1 }],
|
[preset, { arg: 1 }],
|
||||||
[preset2, { arg: 2 }, "some-name"],
|
[preset, { arg: 2 }, "some-name"],
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
expect(calls1).toEqual([{ arg: 1 }]);
|
expect(calls).toEqual([{ arg: 1 }, { arg: 2 }]);
|
||||||
expect(calls2).toEqual([{ arg: 2 }]);
|
|
||||||
});
|
});
|
||||||
it("should merge .env[] presets with parent presets", () => {
|
it("should merge .env[] presets with parent presets", () => {
|
||||||
const { calls: calls1, plugin: preset1 } = makePlugin();
|
const { calls: calls1, plugin: preset1 } = makePlugin();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user