react-code-dataset / wp-calypso /client /state /selectors /test /get-jetpack-credentials-test-status.js
react-code-dataset / wp-calypso /client /state /selectors /test /get-jetpack-credentials-test-status.js
Download wp-calypso/client/state/selectors/test/get-jetpack-credentials-test-status.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 1.79 kB
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/state/selectors/test/get-jetpack-credentials-test-status.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/client/state/selectors/test/get-jetpack-credentials-test-status.js
-
curl -L -o get-jetpack-credentials-test-status.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/state/selectors/test/get-jetpack-credentials-test-status.js
1.79 kB
| import getJetpackCredentialsTestStatus from 'calypso/state/selectors/get-jetpack-credentials-test-status'; | |
| import { sites as SITES_CREDENTIALS_FIXTURE } from './fixtures/jetpack-credentials-test-status'; | |
| describe( 'getJetpackCredentialsTestStatus()', () => { | |
| test( 'should return credentials test is valid', () => { | |
| const stateIn = { | |
| jetpack: { | |
| credentials: { | |
| testStatus: SITES_CREDENTIALS_FIXTURE, | |
| }, | |
| }, | |
| }; | |
| const siteId = 2340000; | |
| const role = 'main'; | |
| const output = getJetpackCredentialsTestStatus( stateIn, siteId, role ); | |
| expect( output ).toEqual( SITES_CREDENTIALS_FIXTURE[ siteId ]?.[ role ] ); | |
| } ); | |
| test( 'should return credentials test is invalid', () => { | |
| const stateIn = { | |
| jetpack: { | |
| credentials: { | |
| testStatus: SITES_CREDENTIALS_FIXTURE, | |
| }, | |
| }, | |
| }; | |
| const siteId = 3450000; | |
| const role = 'main'; | |
| const output = getJetpackCredentialsTestStatus( stateIn, siteId, role ); | |
| expect( output ).toEqual( SITES_CREDENTIALS_FIXTURE[ siteId ]?.[ role ] ); | |
| } ); | |
| test( 'should return credentials test is pending', () => { | |
| const stateIn = { | |
| jetpack: { | |
| credentials: { | |
| testStatus: SITES_CREDENTIALS_FIXTURE, | |
| }, | |
| }, | |
| }; | |
| const siteId = 1230000; | |
| const role = 'main'; | |
| const output = getJetpackCredentialsTestStatus( stateIn, siteId, role ); | |
| expect( output ).toEqual( SITES_CREDENTIALS_FIXTURE[ siteId ]?.[ role ] ); | |
| } ); | |
| test( 'should return credentials test is pending when siteId not exists in state', () => { | |
| const stateIn = { | |
| jetpack: { | |
| credentials: { | |
| testStatus: SITES_CREDENTIALS_FIXTURE, | |
| }, | |
| }, | |
| }; | |
| const siteId = 9990000; | |
| const role = 'main'; | |
| const output = getJetpackCredentialsTestStatus( stateIn, siteId, role ); | |
| expect( output ).toEqual( 'pending' ); | |
| } ); | |
| } ); | |