Skip to content

Commit

Permalink
Restore reregistration unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
noisysocks committed Feb 6, 2023
1 parent 22bd457 commit e2b8e35
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions packages/experiments/src/test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,18 @@ describe( '__dangerousOptInToUnstableAPIsOnlyForCoreModules', () => {
/This feature is only for JavaScript modules shipped with WordPress core/
);
} );
it( 'Should not register the same module twice', () => {
expect( () => {
__dangerousOptInToUnstableAPIsOnlyForCoreModules(
requiredConsent,
'@experiments/test'
);
__dangerousOptInToUnstableAPIsOnlyForCoreModules(
requiredConsent,
'@experiments/test'
);
} ).toThrow( /is already registered/ );
} );
it( 'Should grant access to unstable APIs when passed both a consent string and a previously unregistered package name', () => {
const unstableAPIs = __dangerousOptInToUnstableAPIsOnlyForCoreModules(
requiredConsent,
Expand Down

0 comments on commit e2b8e35

Please sign in to comment.