add msw handler for packages installed

This commit is contained in:
Jacob Overgaard
2022-09-05 15:43:54 +02:00
parent ea6467e036
commit 82d643482b
2 changed files with 12 additions and 3 deletions

View File

@@ -9,6 +9,7 @@ export type AllowedSectionsResponse = components['schemas']['AllowedSectionsResp
export type UmbracoInstaller = components['schemas']['InstallSettingsResponse'];
export type UmbracoUpgrader = components['schemas']['UpgradeSettingsResponse'];
export type ManifestsResponse = components['schemas']['ManifestsResponse'];
export type ManifestsPackagesInstalledResponse = components['schemas']['ManifestsPackagesInstalledResponse'];
// Models
export type UmbracoPerformInstallDatabaseConfiguration = components['schemas']['InstallSetupDatabaseConfiguration'];

View File

@@ -2,7 +2,7 @@ import { rest } from 'msw';
import umbracoPath from '../../core/helpers/umbraco-path';
import type { ManifestsResponse } from '../../core/models';
import type { ManifestsPackagesInstalledResponse, ManifestsResponse } from '../../core/models';
export const manifestDevelopmentHandler = rest.get(umbracoPath('/manifests'), (_req, res, ctx) => {
return res(
@@ -63,21 +63,29 @@ export const manifestEmptyHandler = rest.get(umbracoPath('/manifests'), (_req, r
});
export default [
rest.get(umbracoPath('/manifests/packages'), (_req, res, ctx) => {
rest.get(umbracoPath('/manifests/packages/installed'), (_req, res, ctx) => {
return res(
// Respond with a 200 status code
ctx.status(200),
ctx.json({
ctx.json<ManifestsPackagesInstalledResponse>({
packages: [
{
id: '2a0181ec-244b-4068-a1d7-2f95ed7e6da6',
name: 'My very own package',
alias: 'my.package',
version: '1.0.0',
hasMigrations: false,
hasPendingMigrations: false,
plans: [],
},
{
id: '240d95be-bfdb-4ca2-a601-ed2bfd5ed069',
name: 'Some other community package',
alias: 'our.package',
version: '2.0.1',
hasMigrations: false,
hasPendingMigrations: false,
plans: [],
},
],
})