Skip to content

Commit

Permalink
update getPrefix for layouts
Browse files Browse the repository at this point in the history
  • Loading branch information
nelsonpecora committed Jul 6, 2018
1 parent 2ae12d0 commit 8b4931d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/getPrefix/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ const isUriStringCheck = require('../strCheck');
*/
module.exports = function (uri) {
isUriStringCheck.strCheck(uri);
return uri.split(/\/_(pages|components|lists|uris|schedule|users)/)[0];
return uri.split(/\/_(pages|components|lists|uris|schedule|users|layouts)/)[0];
};
3 changes: 3 additions & 0 deletions lib/getPrefix/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ describe('getPrefix', () => {
it('returns site prefix of page uri', () => {
expect(fn('domain.com/_pages/foo')).to.equal('domain.com');
});
it('returns site prefix of layout uri', () => {
expect(fn('domain.com/_layouts/foo')).to.equal('domain.com');
});
it('works with site with path', () => {
expect(fn('domain.com/a/b/_pages/foo')).to.equal('domain.com/a/b');
});
Expand Down

0 comments on commit 8b4931d

Please sign in to comment.