const describeIfNotEnv = (key, value) => (description, callback, describeFn = describe) => { return value !== process.env[key] ? describeFn(description, callback) : describe.skip(description, callback) }
describe.skip("the Header", () => { it('renders', () => { const { container } = render(<Header text='Hello!' />); expect(container).toMatchSnapshot(); }) it("inserts text in h1", () => { const { getByTestId, getByText } = render(<Header text="asdf" />); expect(getByTestId('h1')).toHaveTextContent('asdf'); expect(getByText('asdf')).toHaveClass('fancy-h1'); // toHaveTextContent is a jest-dom assertion, not included in normal jest // be mindful of jest-dom vs jest assertions }) })
describe.skip('#subscription', () => { const client = new Client({ httpEndpoint, dataSource: 'eth', }); test('should have basic subscription methods for eth', () => { expect(typeof client.newBlockMined).toEqual('function'); expect(typeof client.bigTransactionExecuted).toEqual('function'); }); if (Client.name !== 'OCAPBrowserClient') { test( 'should subscribe to newBlockMined event', async () => { // TODO: setup mock socket server for testing env const subscription = await client.newBlockMined(); expect(subscription instanceof EventEmitter).toEqual(true); expect(subscription.subscriptionId).toBeTruthy(); expect(Object.keys(client.subscriptions).length).toEqual(1); }, 5000 ); } });
const describeIfEnv = (key, value) => (description, callback, describeFn = describe) => { return value === process.env[key] ? describeFn(description, callback) : describe.skip(description, callback) }