Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// @flow
import { uuid } from 'react-cosmos-shared2/util';
import { runTests, mount } from '../testHelpers';
const rendererId = uuid();
const fixtures = { first: null, second: null };
const decorators = {};
runTests(mockConnect => {
it('renders blank state message', async () => {
await mockConnect(async ({ getElement }) => {
await mount(
getElement({ rendererId, fixtures, decorators }),
async renderer => {
expect(renderer.toJSON()).toEqual('No fixture loaded.');
}
);
});
});
it('posts ready response on mount', async () => {
import React from 'react';
import { uuid } from 'react-cosmos-shared2/util';
import { createValues, createValue } from 'react-cosmos-shared2/fixtureState';
import { anyProps } from '../testHelpers/fixtureState';
import { Wrapper } from '../testHelpers/components';
import { runFixtureLoaderTests } from '../testHelpers';
const rendererId = uuid();
const fixtures = {
first: yo
};
const decorators = {};
const fixtureId = { path: 'first', name: null };
runFixtureLoaderTests(mount => {
it('transitions string children into an element with children', async () => {
await mount(
{ rendererId, fixtures, decorators },
async ({ update, selectFixture, fixtureStateChange }) => {
await selectFixture({
rendererId,
fixtureId,
fixtureState: {}
});
function getRendererId(): RendererId {
let id = sessionStorage.getItem('cosmosRendererId');
if (!id) {
id = uuid();
sessionStorage.setItem('cosmosRendererId', id);
}
return id;
}