Skip to content

Commit

Permalink
Add support for Favorites Preferences open / closed (#85)
Browse files Browse the repository at this point in the history
* Add support for Favorites Preferences open / closed

* bump version

* fix format

* Update test

* remove lockfile
  • Loading branch information
gaspar09 authored Dec 20, 2023
1 parent f5674ed commit 4262dab
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@zeit/schemas",
"version": "2.33.0",
"version": "2.34.0",
"description": "All schemas used for validation that are shared between our projects",
"scripts": {
"test": "yarn run lint && best --verbose",
Expand Down
26 changes: 26 additions & 0 deletions test/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,32 @@ exports.test_viewPreference_number_invalid = () => {
assert.equal(isValid, false);
};

exports.test_favoritesViewPreference_open_valid = () => {
assert(ajv.validate(User, { favoritesViewPreference: 'open' }));
};

exports.test_favoritesViewPreference_closed_valid = () => {
assert(ajv.validate(User, { favoritesViewPreference: 'closed' }));
};

exports.test_favoritesViewPreference_null_valid = () => {
assert(ajv.validate(User, { favoritesViewPreference: null }));
};

exports.test_favoritesViewPreference_invalid_value = () => {
const isValid = ajv.validate(User, {
favoritesViewPreference: 'test'
});
assert.equal(isValid, false);
};

exports.test_favoritesViewPreference_number_invalid = () => {
const isValid = ajv.validate(User, {
favoritesViewPreference: 10
});
assert.equal(isValid, false);
};

exports.test_remoteCaching_valid = () => {
assert(ajv.validate(User, { remoteCaching: { enabled: true } }));
};
Expand Down
13 changes: 13 additions & 0 deletions user/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,17 @@ const ViewPreference = {
]
};

const FavoritesViewPreference = {
oneOf: [
{
'enum': ['open', 'closed']
},
{
type: 'null'
}
]
};

const PlatformVersion = {
oneOf: [
{
Expand Down Expand Up @@ -257,6 +268,7 @@ const User = {
scopeId: ScopeId,
gitNamespaceId: GitNamespaceId,
viewPreference: ViewPreference,
favoritesViewPreference: FavoritesViewPreference,
remoteCaching: RemoteCaching,
dismissedToasts: DismissedToasts,
enablePreviewFeedback: EnablePreviewFeedback,
Expand All @@ -278,5 +290,6 @@ module.exports = {
ScopeId,
GitNamespaceId,
ViewPreference,
FavoritesViewPreference,
DismissedToasts
};

0 comments on commit 4262dab

Please sign in to comment.