Skip to content

Commit

Permalink
Add test for when gutenberg isn't the only plugin for validation error
Browse files Browse the repository at this point in the history
  • Loading branch information
delawski committed Oct 27, 2021
1 parent bd39a6e commit 7d2f1d1
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ export function getSlugsFromValidationResults( validationResults = [] ) {
// Skip including AMP in the summary, since AMP is like core.
plugins.delete( 'amp' );


return {
plugins: [ ...plugins ],
themes: [ ...themes ],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ describe( 'getSlugsFromValidationResults', () => {
expect( slugs.themes ).toStrictEqual( [ 'twentytwenty' ] );
} );

it( 'returns Gutenberg if it is the only plugin in the list', () => {
it( 'returns Gutenberg if it is the only plugin for a single validation error', () => {
const validationResult = [
{
sources: [
Expand All @@ -82,4 +82,19 @@ describe( 'getSlugsFromValidationResults', () => {
expect( slugs.plugins ).toStrictEqual( [ 'gutenberg' ] );
expect( slugs.themes ).toStrictEqual( [ 'twentytwenty' ] );
} );

it( 'does not return Gutenberg if there are other plugins for the same validation error', () => {
const validationResult = [
{
sources: [
{ type: 'plugin', name: 'gutenberg' },
{ type: 'plugin', name: 'jetpack' },
],
},
];

const slugs = getSlugsFromValidationResults( validationResult );

expect( slugs.plugins ).toStrictEqual( [ 'jetpack' ] );
} );
} );

0 comments on commit 7d2f1d1

Please sign in to comment.