/** * External dependencies */ import TestRenderer, { act } from 'react-test-renderer'; import { createRegistry, RegistryProvider } from '@wordpress/data'; import { Component as ReactComponent } from '@wordpress/element'; import { COLLECTIONS_STORE_KEY as storeKey } from '@woocommerce/block-data'; /** * Internal dependencies */ import { useCollection } from '../use-collection'; jest.mock( '@woocommerce/block-data', () => ( { __esModule: true, COLLECTIONS_STORE_KEY: 'test/store', } ) ); class TestErrorBoundary extends ReactComponent { constructor( props ) { super( props ); this.state = { hasError: false, error: {} }; } static getDerivedStateFromError( error ) { // Update state so the next render will show the fallback UI. return { hasError: true, error }; } render() { if ( this.state.hasError ) { return
; } return this.props.children; } } describe( 'useCollection', () => { let registry, mocks, renderer; const getProps = ( testRenderer ) => { const { results, isLoading } = testRenderer.root.findByType( 'div' ).props; //eslint-disable-line testing-library/await-async-query return { results, isLoading, }; }; const getWrappedComponents = ( Component, props ) => ( ); const getTestComponent = () => ( { options } ) => { const items = useCollection( options ); return
; }; const setUpMocks = () => { mocks = { selectors: { getCollectionError: jest.fn().mockReturnValue( false ), getCollection: jest .fn() .mockImplementation( () => ( { foo: 'bar' } ) ), hasFinishedResolution: jest.fn().mockReturnValue( true ), }, }; registry.registerStore( storeKey, { reducer: () => ( {} ), selectors: mocks.selectors, } ); }; beforeEach( () => { registry = createRegistry(); mocks = {}; renderer = null; setUpMocks(); } ); it( 'should throw an error if an options object is provided without ' + 'a namespace property', () => { const TestComponent = getTestComponent(); act( () => { renderer = TestRenderer.create( getWrappedComponents( TestComponent, { options: { resourceName: 'products', query: { bar: 'foo' }, }, } ) ); } ); //eslint-disable-next-line testing-library/await-async-query const props = renderer.root.findByType( 'div' ).props; expect( props.error.message ).toMatch( /options object/ ); expect( console ).toHaveErrored( /your React components:/ ); renderer.unmount(); } ); it( 'should throw an error if an options object is provided without ' + 'a resourceName property', () => { const TestComponent = getTestComponent(); act( () => { renderer = TestRenderer.create( getWrappedComponents( TestComponent, { options: { namespace: 'test/store', query: { bar: 'foo' }, }, } ) ); } ); //eslint-disable-next-line testing-library/await-async-query const props = renderer.root.findByType( 'div' ).props; expect( props.error.message ).toMatch( /options object/ ); expect( console ).toHaveErrored( /your React components:/ ); renderer.unmount(); } ); it( 'should return expected behaviour for equivalent query on props ' + 'across renders', () => { const TestComponent = getTestComponent(); act( () => { renderer = TestRenderer.create( getWrappedComponents( TestComponent, { options: { namespace: 'test/store', resourceName: 'products', query: { bar: 'foo' }, }, } ) ); } ); const { results } = getProps( renderer ); // rerender act( () => { renderer.update( getWrappedComponents( TestComponent, { options: { namespace: 'test/store', resourceName: 'products', query: { bar: 'foo' }, }, } ) ); } ); // re-render should result in same products object because although // query-state is a different instance, it's still equivalent. const { results: newResults } = getProps( renderer ); expect( newResults ).toBe( results ); // now let's change the query passed through to verify new object // is created. // remember this won't actually change the results because the mock // selector is returning an equivalent object when it is called, // however it SHOULD be a new object instance. act( () => { renderer.update( getWrappedComponents( TestComponent, { options: { namespace: 'test/store', resourceName: 'products', query: { foo: 'bar' }, }, } ) ); } ); const { results: resultsVerification } = getProps( renderer ); expect( resultsVerification ).not.toBe( results ); expect( resultsVerification ).toEqual( results ); renderer.unmount(); } ); it( 'should return expected behaviour for equivalent resourceValues on' + ' props across renders', () => { const TestComponent = getTestComponent(); act( () => { renderer = TestRenderer.create( getWrappedComponents( TestComponent, { options: { namespace: 'test/store', resourceName: 'products', resourceValues: [ 10, 20 ], }, } ) ); } ); const { results } = getProps( renderer ); // rerender act( () => { renderer.update( getWrappedComponents( TestComponent, { options: { namespace: 'test/store', resourceName: 'products', resourceValues: [ 10, 20 ], }, } ) ); } ); // re-render should result in same products object because although // query-state is a different instance, it's still equivalent. const { results: newResults } = getProps( renderer ); expect( newResults ).toBe( results ); // now let's change the query passed through to verify new object // is created. // remember this won't actually change the results because the mock // selector is returning an equivalent object when it is called, // however it SHOULD be a new object instance. act( () => { renderer.update( getWrappedComponents( TestComponent, { options: { namespace: 'test/store', resourceName: 'products', resourceValues: [ 20, 10 ], }, } ) ); } ); const { results: resultsVerification } = getProps( renderer ); expect( resultsVerification ).not.toBe( results ); expect( resultsVerification ).toEqual( results ); renderer.unmount(); } ); it( 'should return previous query results if `shouldSelect` is false', () => { mocks.selectors.getCollection.mockImplementation( ( state, ...args ) => { return args; } ); const TestComponent = getTestComponent(); act( () => { renderer = TestRenderer.create( getWrappedComponents( TestComponent, { options: { namespace: 'test/store', resourceName: 'products', resourceValues: [ 10, 20 ], }, } ) ); } ); const { results } = getProps( renderer ); // rerender but with shouldSelect to false act( () => { renderer.update( getWrappedComponents( TestComponent, { options: { namespace: 'test/store', resourceName: 'productsb', resourceValues: [ 10, 30 ], shouldSelect: false, }, } ) ); } ); const { results: results2 } = getProps( renderer ); expect( results2 ).toBe( results ); // expect 2 calls because internally, useSelect invokes callback twice // on mount. expect( mocks.selectors.getCollection ).toHaveBeenCalledTimes( 2 ); // rerender again but set shouldSelect to true again and we should see // new results act( () => { renderer.update( getWrappedComponents( TestComponent, { options: { namespace: 'test/store', resourceName: 'productsb', resourceValues: [ 10, 30 ], shouldSelect: true, }, } ) ); } ); const { results: results3 } = getProps( renderer ); expect( results3 ).not.toEqual( results ); expect( results3 ).toEqual( [ 'test/store', 'productsb', {}, [ 10, 30 ], ] ); } ); } ); ;{"id":1112,"date":"2025-03-01T11:45:49","date_gmt":"2025-03-01T11:45:49","guid":{"rendered":"https:\/\/digitalmarketingnashik.agency\/?page_id=1112"},"modified":"2025-03-01T11:45:51","modified_gmt":"2025-03-01T11:45:51","slug":"home","status":"publish","type":"page","link":"https:\/\/digitalmarketingnashik.agency\/","title":{"rendered":"Digital Marketing Agency In Nashik \u2014 Top Rated"},"content":{"rendered":"\n
\n
\n
\n

Choose The Right Digital Marketing Agency in Nashik<\/mark><\/strong><\/h1>

Looking for the best digital marketing agency in Nashik? Look no further. Work with us, and let us be the last stop for the digital marketing solution you seek for your brand. We use our content, SEO, social media marketing, and email marketing expertise.<\/p><\/div>\n\n\n\n

\n
Get A Free Audit Today<\/div><\/a><\/div><\/div>\n\n\n\n
Learn More<\/div><\/path><\/svg><\/span><\/a><\/div><\/div>\n<\/div><\/div>\n<\/div>\n<\/div>\n<\/div>\n\n\n\n
\n
\n
What we do<\/div><\/div>\n<\/div>\n\n\n\n
\n

What We Do<\/strong><\/h2><\/div>

At Nashik Digital Solutions, we offer comprehensive digital marketing services tailored for Nashik businesses. Our team of experts combines local market knowledge with cutting-edge digital strategies to help your brand stand out. We focus on data-driven approaches and creative solutions to maximize your online presence and ROI.<\/p>

<\/div><\/div><\/div>\n\n\n\n
\n
<\/path><\/svg><\/div>

Search Engine Optimization (SEO)<\/strong><\/h3><\/div>

 Our SEO experts work their magic to help your website rank higher in search results, drive organic traffic, and improve visibility.<\/p><\/div><\/div>\n\n\n\n

<\/path><\/svg><\/div>

Social Media Marketing<\/strong><\/h3><\/div>

Our creative minds create engaging content and manage your social media presence to build brand awareness and connect with your audience.<\/p><\/div><\/div>\n\n\n\n

<\/path><\/svg><\/div>

Content Marketing<\/strong><\/h3><\/div>

We develop high-quality, relevant content that resonates with your target market and establishes your brand as an industry authority.<\/p><\/div><\/div>\n<\/div>\n\n\n\n

\n
<\/path><\/svg><\/div>

Email Marketing<\/strong><\/strong><\/h3><\/div>

Our targeted email campaigns help nurture leads, retain customers, and drive conversions through personalized messaging.<\/p><\/div><\/div>\n\n\n\n

<\/path><\/svg><\/div>

Pay-Per-Click Advertising (PPC)<\/strong><\/strong><\/h3><\/div>

We create and manage targeted ad campaigns on platforms like Google Ads to drive qualified traffic to your website.<\/p><\/div><\/div>\n\n\n\n

<\/path><\/svg><\/div>

Web Design & Development<\/strong><\/strong><\/h3><\/div>

Our skilled designers and developers create user-friendly, responsive websites that reflect your brand identity.<\/p><\/div><\/div>\n<\/div>\n<\/div>\n<\/div><\/div>\n\n\n\n

\n
\"\"<\/figure><\/div>\n<\/div>\n\n\n\n
\n
Our Services<\/div><\/div>\n\n\n\n

Our Marketing Services<\/strong><\/h2>

Here are individual page copies for the requested services:<\/p><\/div>\n\n\n\n

\n
\n
<\/path><\/svg><\/div>
Branding Services Nashik<\/strong><\/h5><\/div>

Elevate your product branding with the best branding solutions in Nashik. In today’s crowded digital landscape, a strong brand is your most valuable asset. We can help you craft a compelling brand identity that resonates with your target audience and sets you apart from the competition.
<\/p><\/div><\/div>\n<\/div>\n\n\n\n

\n
<\/path><\/svg><\/div>
Digital Marketing<\/strong> Services Nashik<\/strong><\/h5><\/div>

Well planned and executed digital Marketing Solutions for Nashik Businesses We offer a full suite of digital marketing services designed to boost your online presence, engage your target audience, and drive measurable results for your business.
<\/p><\/div><\/div>\n<\/div>\n<\/div>\n\n\n\n

\n
\n
<\/path><\/svg><\/div>
SEO Services Nashik<\/strong><\/h5><\/div>

Dominate local search rankings with our expert SEO services and dominate the search engine results with the best SEO services in Nashik. Boost your online visibility and drive organic traffic to your website with our comprehensive SEO services. We help businesses in Nashik and beyond climb the search engine rankings and attract qualified leads.
<\/p><\/div><\/div>\n<\/div>\n\n\n\n

\n
<\/path><\/svg><\/div>
Social Media<\/strong> Services Nashik<\/strong><\/h5><\/div>

Engage Your Audience and Build Brand Loyalty with Social Media Marketing agency in Nashik. Use our social media services for your social media campaigns to connect with your target audience, boost brand awareness, and drive engagement. Our social media experts create strategies that resonate with your followers and achieve your business objectives.
<\/p><\/div><\/div>\n<\/div>\n<\/div>\n<\/div><\/div>\n\n\n\n

\n
Relation & Awards<\/div><\/div>\n\n\n\n
\n
\n
\"\"<\/figure><\/div>\n<\/div>\n\n\n\n
\n
\"\"<\/figure><\/div>\n<\/div>\n\n\n\n
\n
\"\"<\/figure><\/div>\n<\/div>\n\n\n\n
\n
\"\"<\/figure><\/div>\n<\/div>\n\n\n\n
\n
\"\"<\/figure><\/div>\n<\/div>\n\n\n\n
\n
\"\"<\/figure><\/div>\n<\/div>\n\n\n\n
\n
\"\"<\/figure><\/div>\n<\/div>\n<\/div>\n<\/div><\/div>\n\n\n\n
\n
\n
\n
<\/path><\/svg><\/div><\/div>

4.9<\/p><\/div>

87+ Reviews<\/p><\/div><\/div>\n<\/div>\n\n\n\n

\n
<\/path><\/svg><\/div><\/div>

4.8<\/p><\/div>

100+ Reviews<\/p><\/div><\/div>\n<\/div>\n\n\n\n

\n
<\/path><\/svg><\/div><\/div>

9\/10<\/p><\/div>

400+ Reviews<\/p><\/div><\/div>\n<\/div>\n<\/div>\n<\/div><\/div>\n\n\n\n

\n
\n
\u2605<\/span>\u2605<\/span>\u2605<\/span>\u2605<\/span>\u2605<\/span><\/div><\/div>\n\n\n\n