Skip to content

Commit

Permalink
cleanup enzyme code from test-length test
Browse files Browse the repository at this point in the history
  • Loading branch information
vraja-pro committed Sep 21, 2023
1 parent 56ab77f commit eb33202
Showing 1 changed file with 2 additions and 15 deletions.
17 changes: 2 additions & 15 deletions packages/js/tests/insights/components/text-length.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { shallow } from "enzyme";
import React from "react";
// import React from "react";
import { useSelect } from "@wordpress/data";
import TextLength from "../../../src/insights/components/text-length";
// import TextLength from "../../../src/insights/components/text-length";

jest.mock( "@wordpress/data", () => (
{
Expand Down Expand Up @@ -37,24 +36,12 @@ describe( "a test for TextLength component", () => {
count: 300,
unit: "words",
} );
const render = shallow( <TextLength /> );

expect( render.props().amount ).toBe( 300 );
expect( render.props().linkText ).toBe( "Learn more about word count" );
expect( render.props().title ).toBe( "Word count" );
expect( render.props().unit ).toBe( "words" );
} );

it( "returns the props for languages that use character as the unit for text length measurement", () => {
mockSelect( {
count: 300,
unit: "character",
} );
const render = shallow( <TextLength /> );

expect( render.props().amount ).toBe( 300 );
expect( render.props().linkText ).toBe( "Learn more about character count" );
expect( render.props().title ).toBe( "Character count" );
expect( render.props().unit ).toBe( "characters" );
} );
} );

0 comments on commit eb33202

Please sign in to comment.