Download wp-calypso/client/test-helpers/use-nock/integration/index.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 1.02 kB
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/test-helpers/use-nock/integration/index.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/client/test-helpers/use-nock/integration/index.js
-
curl -L -o index.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/test-helpers/use-nock/integration/index.js
1.02 kB
| import { nock, useNock } from '../index.js'; | |
| describe( 'useNock', () => { | |
| useNock(); | |
| describe( 'Messy without useNock', () => { | |
| // eslint-disable-next-line jest/expect-expect | |
| test( 'sets up a persistent interceptor', () => { | |
| nock( 'wordpress.com' ).persist().get( '/me' ).reply( 200, { id: 42 } ); | |
| } ); | |
| } ); | |
| describe( 'Illustration Block', () => { | |
| test( 'still sees the earlier persistent connection', () => { | |
| expect( nock.isDone() ).toBe( false ); | |
| } ); | |
| afterAll( () => nock.cleanAll() ); | |
| } ); | |
| describe( 'Clean with useNock', () => { | |
| useNock(); | |
| test( 'sets up a persistent interceptor', () => { | |
| nock( 'wordpress.com' ).persist().get( '/me' ).reply( 200, { id: 42 } ); | |
| expect( nock.isDone() ).toBe( false ); | |
| } ); | |
| test( 'persists inside the same `describe` block', () => { | |
| expect( nock.isDone() ).toBe( false ); | |
| } ); | |
| } ); | |
| describe( 'Test Block', () => { | |
| test( 'should have reset all remaining nocks', () => { | |
| expect( nock.isDone() ).toBe( true ); | |
| } ); | |
| } ); | |
| } ); | |