diff --git a/package.json b/package.json index 942f227..12e217a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@zeit/schemas", - "version": "2.34.0", + "version": "2.35.0", "description": "All schemas used for validation that are shared between our projects", "scripts": { "test": "yarn run lint && best --verbose", diff --git a/test/user.js b/test/user.js index 337bebd..f6eacad 100644 --- a/test/user.js +++ b/test/user.js @@ -346,6 +346,32 @@ exports.test_favoritesViewPreference_number_invalid = () => { assert.equal(isValid, false); }; +exports.test_recentsViewPreference_open_valid = () => { + assert(ajv.validate(User, { recentsViewPreference: 'open' })); +}; + +exports.test_recentsViewPreference_closed_valid = () => { + assert(ajv.validate(User, { recentsViewPreference: 'closed' })); +}; + +exports.test_recentsViewPreference_null_valid = () => { + assert(ajv.validate(User, { recentsViewPreference: null })); +}; + +exports.test_recentsViewPreference_invalid_value = () => { + const isValid = ajv.validate(User, { + recentsViewPreference: 'test' + }); + assert.equal(isValid, false); +}; + +exports.test_recentsViewPreference_number_invalid = () => { + const isValid = ajv.validate(User, { + recentsViewPreference: 10 + }); + assert.equal(isValid, false); +}; + exports.test_remoteCaching_valid = () => { assert(ajv.validate(User, { remoteCaching: { enabled: true } })); }; diff --git a/user/index.js b/user/index.js index ef79f67..714e62d 100644 --- a/user/index.js +++ b/user/index.js @@ -82,7 +82,7 @@ const ViewPreference = { ] }; -const FavoritesViewPreference = { +const ToggleViewPreference = { oneOf: [ { 'enum': ['open', 'closed'] @@ -268,7 +268,8 @@ const User = { scopeId: ScopeId, gitNamespaceId: GitNamespaceId, viewPreference: ViewPreference, - favoritesViewPreference: FavoritesViewPreference, + favoritesViewPreference: ToggleViewPreference, + recentsViewPreference: ToggleViewPreference, remoteCaching: RemoteCaching, dismissedToasts: DismissedToasts, enablePreviewFeedback: EnablePreviewFeedback, @@ -290,6 +291,6 @@ module.exports = { ScopeId, GitNamespaceId, ViewPreference, - FavoritesViewPreference, + ToggleViewPreference, DismissedToasts };