How to use the @times-components/test-utils.delay function in @times-components/test-utils

To help you get started, we’ve selected a few @times-components/test-utils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github newsuk / times-components / packages / pages / __tests__ / puzzle-count-sync.js View on Github external
const count = 12;

    getOpenedPuzzleCount.mockReturnValue(Promise.resolve(count));

    const testInstance = TestRenderer.create(
      
    );

    // Initial Count
    expect(testInstance.toJSON()).toEqual(`${initialCount}`);

    // Updated Count with native bridge
    await delay(0);
    expect(testInstance.toJSON()).toEqual(`${count}`);
  });
};
github newsuk / times-components / packages / save-star-web / __tests__ / shared.base.js View on Github external
it("check that the event default is properly prevented", async () => {
      const testInstance = TestRenderer.create(
        
      );

      const [saveStarLink] = testInstance.root.findAllByType(Link);
      await delay(0);

      const preventDefault = jest.fn();
      saveStarLink.props.onPress({ preventDefault });

      expect(preventDefault).toHaveBeenCalled();
    });
  });
github newsuk / times-components / packages / message-bar / __tests__ / message-bar.base.js View on Github external
test: async () => {
      const testInstance = TestRenderer.create(
         {}}
          delay={1}
          message="test message"
          scale={scales.medium}
        />
      );

      await delay(500);

      expect(testInstance.toJSON()).toMatchSnapshot();
    }
  },
github newsuk / times-components / packages / pages / __tests__ / saved-star-sync.js View on Github external
await delay(0);
    expect(testInstance.toJSON()).toMatchSnapshot("initial sync");

    const [
      {
        props: { onPress }
      }
    ] = testInstance.root.findAllByType(View);

    onPress(true, "789");
    await delay(0);
    expect(testInstance.toJSON()).toMatchSnapshot("save article 789");

    onPress(false, "456");
    await delay(0);
    expect(testInstance.toJSON()).toMatchSnapshot("unsave article 456");
  });
github newsuk / times-components / packages / message-bar / __tests__ / message-bar.base.js View on Github external
test: async () => {
      const closed = jest.fn();
      const testInstance = shallow(
        
      );

      const button = testInstance.find(TouchableOpacity);
      button.simulate("press");
      await delay(10);
      expect(closed).toBeCalled();
    }
  },

@times-components/test-utils

Test helpers for Times Components

BSD-3-Clause
Latest version published 5 months ago

Package Health Score

84 / 100
Full package analysis