Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 27 additions & 4 deletions packages/cli/src/commands/validate-json-strict-exit.e2e.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,15 @@ export default defineStack({
}, { strict: false });
`;

/** The zero-warning control — pins the other end of the matrix. */
/**
* The zero-warning control — pins the other end of the matrix.
*
* The app opens its object from navigation and the object declares a list
* view: without the entry the app-shell rules raise `app-navigation-empty` and
* `object-unreachable-from-navigation`, and with the entry but no view they
* raise `object-without-view`, each a warning `--strict` promotes. The fixtures
* below copy this object and app, for the same reason.
*/
const CLEAN_SOURCE = `
import { defineStack } from '@objectstack/spec';

Expand All @@ -181,8 +189,13 @@ export default defineStack({
label: 'Ticket',
sharingModel: 'private',
fields: { title: { type: 'text', label: 'Title' } },
listViews: { all: { type: 'grid', columns: ['title'] } },
}],
apps: [{
name: 'strictexit_app',
label: 'Strict Exit App',
navigation: [{ id: 'nav_ticket', type: 'object', label: 'Tickets', objectName: 'strictexit_ticket' }],
}],
apps: [{ name: 'strictexit_app', label: 'Strict Exit App' }],
}, { strict: false });
`;

Expand Down Expand Up @@ -210,8 +223,13 @@ export default defineStack({
label: 'Ticket',
sharingModel: 'private',
fields: { title: { type: 'text', label: 'Title' } },
listViews: { all: { type: 'grid', columns: ['title'] } },
}],
apps: [{
name: 'strictexit_app',
label: 'Strict Exit App',
navigation: [{ id: 'nav_ticket', type: 'object', label: 'Tickets', objectName: 'strictexit_ticket' }],
}],
apps: [{ name: 'strictexit_app', label: 'Strict Exit App' }],
flows: [{
name: 'strictexit_notify',
label: 'Notify',
Expand Down Expand Up @@ -249,8 +267,13 @@ export default defineStack({
label: 'Ticket',
sharingModel: 'private',
fields: { title: { type: 'text', label: 'Title' } },
listViews: { all: { type: 'grid', columns: ['title'] } },
}],
apps: [{
name: 'strictexit_app',
label: 'Strict Exit App',
navigation: [{ id: 'nav_ticket', type: 'object', label: 'Tickets', objectName: 'strictexit_ticket' }],
}],
apps: [{ name: 'strictexit_app', label: 'Strict Exit App' }],
${finding === 'info'
? ` permissions: [{ name: 'strictexit_reader', label: 'Reader', objects: { strictexit_ticket: { allowRead: true } } }],`
: ` tools: [{
Expand Down
17 changes: 10 additions & 7 deletions packages/cli/test/jsx-gate-manifest-notice.e2e.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,17 +125,20 @@ function noticesIn(payload: Record<string, unknown>): Array<Record<string, unkno
}

/**
* A stack with no advisory of its own on any of the three commands — an app,
* an engines range, a private object — so under `--strict` the ONLY thing that
* A stack with no advisory of its own on any of the three commands — an app
* whose navigation opens the object, an engines range, a private object with a
* list view (the app-shell rules warn on an object no entry opens, and on one
* opened with no list view) — so under `--strict` the ONLY thing that
* could move the exit status is the notice. `body` is the page source, or
* `null` for a stack with no pages at all.
*/
function stack(body: string | null): string {
const pages = body === null ? '' : `pages: [{ name: 'jxg_landing', label: 'Landing', kind: 'html', source: '${body}' }],`;
// The object entry in every member, so the app-shell rules find the object
// reachable; the page entry beside it only where there is a page to open.
const ticket = `{ id: 'nav_ticket', type: 'object', label: 'Tickets', objectName: 'jxg_ticket' }`;
const nav =
body === null
? `{ id: 'nav_ticket', type: 'object', label: 'Tickets', objectName: 'jxg_ticket' }`
: `{ id: 'nav_landing', type: 'page', label: 'Landing', pageName: 'jxg_landing' }`;
body === null ? ticket : `${ticket}, { id: 'nav_landing', type: 'page', label: 'Landing', pageName: 'jxg_landing' }`;
return `
import { defineStack } from '@objectstack/spec';

Expand All @@ -144,7 +147,7 @@ export default defineStack({
${pages}
apps: [{ name: 'jxg_app', label: 'JXG', navigation: [${nav}] }],
objects: [
{ name: 'jxg_ticket', label: 'Ticket', sharingModel: 'private', fields: { title: { type: 'text', label: 'Title' } } },
{ name: 'jxg_ticket', label: 'Ticket', sharingModel: 'private', fields: { title: { type: 'text', label: 'Title' } }, listViews: { all: { type: 'grid', columns: ['title'] } } },
],
}, { strict: false });
`;
Expand Down Expand Up @@ -172,7 +175,7 @@ export default defineStack({
],
apps: [{ name: 'jxg_app', label: 'JXG', navigation: [{ id: 'nav_ticket', type: 'object', label: 'Tickets', objectName: 'jxg_ticket' }] }],
objects: [
{ name: 'jxg_ticket', label: 'Ticket', sharingModel: 'private', fields: { title: { type: 'text', label: 'Title' } } },
{ name: 'jxg_ticket', label: 'Ticket', sharingModel: 'private', fields: { title: { type: 'text', label: 'Title' } }, listViews: { all: { type: 'grid', columns: ['title'] } } },
],
}, { strict: false });
`;
Expand Down
16 changes: 14 additions & 2 deletions packages/cli/test/validate-json-warning-parity.e2e.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,14 @@ export default defineStack({
},
];

/** The zero-warning control — see the test that uses it. */
/**
* The zero-warning control — see the test that uses it.
*
* The app opens its object from navigation and the object declares a list
* view: without the entry the app-shell rules raise `app-navigation-empty` and
* `object-unreachable-from-navigation`, and with the entry but no view they
* raise `object-without-view`.
*/
const CLEAN_SOURCE = `
import { defineStack } from '@objectstack/spec';

Expand All @@ -143,8 +150,13 @@ export default defineStack({
label: 'Ticket',
sharingModel: 'private',
fields: { title: { type: 'text', label: 'Title' } },
listViews: { all: { type: 'grid', columns: ['title'] } },
}],
apps: [{
name: 'clean_app',
label: 'Clean App',
navigation: [{ id: 'nav_ticket', type: 'object', label: 'Tickets', objectName: 'clean_ticket' }],
}],
apps: [{ name: 'clean_app', label: 'Clean App' }],
}, { strict: false });
`;

Expand Down
Loading