-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Not complete yet, just work done so far. So test fails are expected still.
- Loading branch information
Showing
35 changed files
with
1,946 additions
and
126 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
assets/src/data/eventespresso/core/actions/test/create-entities-generators.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import { isGenerator, isModelEntity } from '@eventespresso/validators'; | ||
|
||
/** | ||
* Internal imports | ||
*/ | ||
import { createEntity } from '../create-entities-generators'; | ||
import { eventFactory } from '../../../test/fixtures/base'; | ||
import { ACTION_TYPES } from '../action-types'; | ||
|
||
const { entities: types } = ACTION_TYPES; | ||
|
||
describe( 'createEntity()', () => { | ||
describe( 'yields with expected response', () => { | ||
const TestEvent = { EVT_name: 'test event' }; | ||
let fulfillment; | ||
const reset = () => | ||
fulfillment = createEntity( 'event', TestEvent ); | ||
it( 'yields a generator for retrieving an Event factory', () => { | ||
reset(); | ||
const { value } = fulfillment.next(); | ||
expect( isGenerator( value ) ).toBe( true ); | ||
} ); | ||
it( 'yields null when invalid factory retrieved', () => { | ||
const { value } = fulfillment.next(); | ||
expect( value ).toBe( null ); | ||
} ); | ||
it( 'yields expected action for valid factory retrieved', () => { | ||
reset(); | ||
fulfillment.next(); | ||
const { value: action } = fulfillment.next( eventFactory ); | ||
expect( action.type ).toEqual( types.RECEIVE_ENTITY ); | ||
expect( isModelEntity( action.entity ) ).toBe( true ); | ||
expect( action.entity.EVT_name ).toEqual( 'test event' ); | ||
} ); | ||
it( 'returns entityInstance', () => { | ||
const { value: event } = fulfillment.next(); | ||
expect( isModelEntity( event ) ).toBe( true ); | ||
expect( event.EVT_name ).toEqual( 'test event' ); | ||
} ); | ||
} ); | ||
} ); |
Oops, something went wrong.