-
Notifications
You must be signed in to change notification settings - Fork 196
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* test: api me * refactor: minor * refactor: minor * refactor: minor * test: e2e * ci: code owner * ci: code owner * refactor: rename * refactor: minor * refactor: minor * refactor: plan id * refactor: minor
- Loading branch information
1 parent
ee95483
commit c7449ee
Showing
3 changed files
with
286 additions
and
0 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
76 changes: 76 additions & 0 deletions
76
packages/tests/src/e2e/m365/ProvisionApiSpecMessageExtension.tests.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT license. | ||
|
||
/** | ||
* @author Yuqi Zhou <[email protected]> | ||
*/ | ||
|
||
import { describe } from "mocha"; | ||
import * as chai from "chai"; | ||
import * as path from "path"; | ||
|
||
import { it } from "@microsoft/extra-shot-mocha"; | ||
|
||
import { CliHelper } from "../../commonlib/cliHelper"; | ||
import { Capability } from "../../utils/constants"; | ||
import { | ||
cleanUpLocalProject, | ||
getTestFolder, | ||
getUniqueAppName, | ||
readContextMultiEnvV3, | ||
} from "../commonUtils"; | ||
import { deleteTeamsApp, getTeamsApp } from "../debug/utility"; | ||
|
||
describe("Provision V3 api-based-message-extension api=-spec template", () => { | ||
const testFolder = getTestFolder(); | ||
const appName = getUniqueAppName(); | ||
const projectPath = path.resolve(testFolder, appName); | ||
|
||
afterEach(async function () { | ||
// clean up | ||
const context = await readContextMultiEnvV3(projectPath, "dev"); | ||
if (context?.TEAMS_APP_ID) { | ||
await deleteTeamsApp(context.TEAMS_APP_ID); | ||
} | ||
|
||
await cleanUpLocalProject(projectPath); | ||
}); | ||
|
||
it( | ||
"happy path: scaffold and provision", | ||
{ testPlanCaseId: 25285721, author: "[email protected]" }, | ||
async function () { | ||
const apiSpecPath = path.join(__dirname, "apispec.yml"); | ||
// create | ||
await CliHelper.createProjectWithCapability( | ||
appName, | ||
testFolder, | ||
Capability.M365SearchApp, | ||
undefined, | ||
`--me-architecture api-spec --openapi-spec-location ${apiSpecPath} --api-operation "GET /repairs"` | ||
); | ||
console.log(`[Successfully] scaffold to ${projectPath}`); | ||
|
||
// provision | ||
|
||
await CliHelper.provisionProject(projectPath, "", "dev", { | ||
...process.env, | ||
}); | ||
console.log(`[Successfully] provision for ${projectPath}`); | ||
|
||
const context = await readContextMultiEnvV3(projectPath, "dev"); | ||
chai.assert.isDefined(context); | ||
|
||
// validate teams app | ||
chai.assert.isDefined(context.TEAMS_APP_ID); | ||
const teamsApp = await getTeamsApp(context.TEAMS_APP_ID); | ||
chai.assert.equal(teamsApp?.teamsAppId, context.TEAMS_APP_ID); | ||
|
||
// validate m365 | ||
chai.assert.isDefined(context.M365_TITLE_ID); | ||
chai.assert.isNotEmpty(context.M365_TITLE_ID); | ||
chai.assert.isDefined(context.M365_APP_ID); | ||
chai.assert.isNotEmpty(context.M365_APP_ID); | ||
} | ||
); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,209 @@ | ||
{ | ||
"openapi": "3.0.0", | ||
"info": { | ||
"title": "Repair Service", | ||
"description": "A simple service to manage repairs for various items", | ||
"version": "1.0.0" | ||
}, | ||
"servers": [ | ||
{ | ||
"url": "https://test.com/" | ||
} | ||
], | ||
"paths": { | ||
"/repairs": { | ||
"get": { | ||
"operationId": "listRepairs", | ||
"summary": "List all repairs", | ||
"description": "Returns a list of repairs with their details and images", | ||
"parameters": [ | ||
{ | ||
"name": "assignedTo", | ||
"in": "query", | ||
"description": "Filter repairs by who they're assigned to", | ||
"schema": { | ||
"type": "string" | ||
}, | ||
"required": false | ||
} | ||
], | ||
"responses": { | ||
"200": { | ||
"description": "A successful response", | ||
"content": { | ||
"application/json": { | ||
"schema": { | ||
"type": "array", | ||
"items": { | ||
"type": "object", | ||
"properties": { | ||
"id": { | ||
"type": "integer", | ||
"description": "The unique identifier of the repair" | ||
}, | ||
"title": { | ||
"type": "string", | ||
"description": "The short summary of the repair" | ||
}, | ||
"description": { | ||
"type": "string", | ||
"description": "The detailed description of the repair" | ||
}, | ||
"assignedTo": { | ||
"type": "string", | ||
"description": "The user who is responsible for the repair" | ||
}, | ||
"date": { | ||
"type": "string", | ||
"format": "date-time", | ||
"description": "The date and time when the repair is scheduled or completed" | ||
}, | ||
"image": { | ||
"type": "string", | ||
"format": "uri", | ||
"description": "The URL of the image of the item to be repaired or the repair process" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"post": { | ||
"operationId": "createRepair", | ||
"summary": "Create a new repair", | ||
"description": "Adds a new repair to the list with the given details and image URL", | ||
"requestBody": { | ||
"required": true, | ||
"content": { | ||
"application/json": { | ||
"schema": { | ||
"type": "object", | ||
"properties": { | ||
"title": { | ||
"type": "string", | ||
"description": "The short summary of the repair" | ||
}, | ||
"description": { | ||
"type": "string", | ||
"description": "The detailed description of the repair" | ||
}, | ||
"assignedTo": { | ||
"type": "string", | ||
"description": "The user who is responsible for the repair" | ||
}, | ||
"date": { | ||
"type": "string", | ||
"format": "date-time", | ||
"description": "The optional date and time when the repair is scheduled or completed" | ||
}, | ||
"image": { | ||
"type": "string", | ||
"format": "uri", | ||
"description": "The URL of the image of the item to be repaired or the repair process" | ||
} | ||
}, | ||
"required": [ | ||
"title", | ||
"description", | ||
"assignedTo" | ||
] | ||
} | ||
} | ||
} | ||
}, | ||
"responses": { | ||
"201": { | ||
"description": "A successful response indicating that the repair was created" | ||
} | ||
} | ||
}, | ||
"patch": { | ||
"summary": "Update an existing repair", | ||
"description": "Update an existing repair to the list with the new updated details and image URL", | ||
"requestBody": { | ||
"required": true, | ||
"content": { | ||
"application/json": { | ||
"schema": { | ||
"type": "object", | ||
"required": [ | ||
"id" | ||
], | ||
"properties": { | ||
"id": { | ||
"type": "integer", | ||
"description": "The unique identifier of the repair to update" | ||
}, | ||
"title": { | ||
"type": "string", | ||
"description": "The short summary of the repair" | ||
}, | ||
"description": { | ||
"type": "string", | ||
"description": "The detailed description of the repair" | ||
}, | ||
"assignedTo": { | ||
"type": "string", | ||
"description": "The user who is responsible for the repair" | ||
}, | ||
"date": { | ||
"type": "string", | ||
"format": "date-time", | ||
"description": "The date and time when the repair is scheduled or completed" | ||
}, | ||
"image": { | ||
"type": "string", | ||
"format": "uri", | ||
"description": "The URL of the image of the item to be repaired or the repair process" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"responses": { | ||
"200": { | ||
"description": "Repair updated" | ||
}, | ||
"404": { | ||
"description": "Repair not found" | ||
} | ||
} | ||
}, | ||
"delete": { | ||
"summary": "Delete an existing repair", | ||
"description": "Delete an existing repair from the list using its ID", | ||
"requestBody": { | ||
"required": true, | ||
"content": { | ||
"application/json": { | ||
"schema": { | ||
"type": "object", | ||
"required": [ | ||
"id" | ||
], | ||
"properties": { | ||
"id": { | ||
"type": "integer", | ||
"description": "The unique identifier of the repair to delete" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"responses": { | ||
"200": { | ||
"description": "Repair deleted" | ||
}, | ||
"404": { | ||
"description": "Repair not found" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |