Expose GK api on client
Summary: Make sure that GKs can be used in pure sandy plugins. Reviewed By: jknoxville Differential Revision: D25368358 fbshipit-source-id: c7c6aa4ecf0443cb3b5d90e22e8aca9a73a69389
This commit is contained in:
committed by
Facebook GitHub Bot
parent
031cec299b
commit
698df77553
@@ -401,3 +401,31 @@ test('available methods can be overridden', async () => {
|
||||
);
|
||||
expect(await plugin.instance.checkEnabled()).toBeFalsy();
|
||||
});
|
||||
|
||||
test('GKs are supported', () => {
|
||||
const pluginModule = {
|
||||
plugin(client: PluginClient<{}, {}>) {
|
||||
return {
|
||||
isTest() {
|
||||
return client.GK('bla');
|
||||
},
|
||||
};
|
||||
},
|
||||
Component() {
|
||||
return null;
|
||||
},
|
||||
};
|
||||
|
||||
{
|
||||
const plugin = TestUtils.startPlugin(pluginModule);
|
||||
expect(plugin.instance.isTest()).toBe(false);
|
||||
}
|
||||
{
|
||||
const plugin = TestUtils.startPlugin(pluginModule, {GKs: ['bla']});
|
||||
expect(plugin.instance.isTest()).toBe(true);
|
||||
}
|
||||
{
|
||||
const plugin = TestUtils.startPlugin(pluginModule, {GKs: ['x']});
|
||||
expect(plugin.instance.isTest()).toBe(false);
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user