Skip to content

Commit

Permalink
Use a more straightforward mapping from block name to fixture filename
Browse files Browse the repository at this point in the history
  • Loading branch information
nylen committed Jun 30, 2017
1 parent 2b9659c commit c140f30
Show file tree
Hide file tree
Showing 218 changed files with 10 additions and 10 deletions.
14 changes: 7 additions & 7 deletions blocks/test/fixtures/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ Each test is made up of four fixture files:

Every block is required to have at least one such set of fixture files to test
the parsing and serialization of that block. These fixtures must be named like
`core-blockname{-*,}.{html,json,serialized.html}`. For example, for the
`core__blockname{__*,}.{html,json,serialized.html}`. For example, for the
`core/image` block, the following four fixture files must exist:

1. `core-image.html` (or `core-image-specific-test-name.html`). Must contain a
`<!-- wp:core/image -->` block.
2. `core-image.parsed.json` (or `core-image-specific-test-name.parsed.json`).
3. `core-image.json` (or `core-image-specific-test-name.json`).
4. `core-image.serialized.html` (or
`core-image-specific-test-name.serialized.html`).
1. `core__image.html` (or `core__image__specific-test-name.html`). Must
contain a `<!-- wp:core/image -->` block.
2. `core__image.parsed.json` (or `core__image__specific-test-name.parsed.json`).
3. `core__image.json` (or `core__image__specific-test-name.json`).
4. `core__image.serialized.html` (or
`core__image__specific-test-name.serialized.html`).

Ideally all important attributes and features of the block should be tested
this way. New contributions in the form of additional test cases are always
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions blocks/test/full-content.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,11 +158,11 @@ describe( 'full post content fixture', () => {
const errors = [];

getBlockTypes().map( block => block.name ).forEach( name => {
const nameToFilename = name.replace( /\//g, '-' );
const nameToFilename = name.replace( /\//g, '__' );
const foundFixtures = fileBasenames
.filter( basename => (
basename === nameToFilename ||
startsWith( basename, nameToFilename + '-' )
startsWith( basename, nameToFilename + '__' )
) )
.map( basename => {
const filename = basename + '.html';
Expand All @@ -175,7 +175,7 @@ describe( 'full post content fixture', () => {

if ( ! foundFixtures.length ) {
errors.push( format(
'Expected a fixture file called \'%s.html\' or \'%s-*.html\'.',
'Expected a fixture file called \'%s.html\' or \'%s__*.html\'.',
nameToFilename,
nameToFilename
) );
Expand Down

0 comments on commit c140f30

Please sign in to comment.