From d2d41c6f139920c785395d52439eb27be244df7d Mon Sep 17 00:00:00 2001 From: bnechyporenko Date: Tue, 10 May 2022 09:34:52 +0200 Subject: [PATCH] Added a unit test Signed-off-by: bnechyporenko --- .../src/plugin/Plugin.test.tsx | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/packages/core-plugin-api/src/plugin/Plugin.test.tsx b/packages/core-plugin-api/src/plugin/Plugin.test.tsx index b66235e210..26c704517f 100644 --- a/packages/core-plugin-api/src/plugin/Plugin.test.tsx +++ b/packages/core-plugin-api/src/plugin/Plugin.test.tsx @@ -32,3 +32,35 @@ describe('Plugin Feature Flag', () => { ).toEqual([]); }); }); + +describe('Plugin metadata', () => { + it('should be able to define metadata', () => { + expect( + createPlugin({ + id: 'test', + metadata: { + key: 'value', + }, + }).getMetadata(), + ).toEqual({ + key: 'value', + }); + }); + + it('should be able to reconfigure metadata', () => { + const plugin = createPlugin({ + id: 'test', + metadata: { + key: 'original-value', + }, + }); + + plugin.reconfigure({ + key: 'modified-value', + }); + + expect(plugin.getMetadata()).toEqual({ + key: 'modified-value', + }); + }); +});