Skip to content

Commit

Permalink
Add e2e-test for retrieving sched. DSL TS
Browse files Browse the repository at this point in the history
  • Loading branch information
pcrosemurgy committed Nov 7, 2022
1 parent 1c0dd8f commit 7b85970
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 1 deletion.
5 changes: 5 additions & 0 deletions e2e-tests/src/tests/scheduler.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ test.describe('Scheduling', () => {
await delay(2000);
});

test('Get scheduling DSL TypeScript', async ({ request }) => {
const schedulingDslTypes = await req.getSchedulingDslTypeScript(request, mission_model_id);
expect(schedulingDslTypes.typescriptFiles.length).toEqual(6);
});

test('Create Plan', async ({ request }) => {
const plan_input : CreatePlanInput = {
model_id : mission_model_id,
Expand Down
7 changes: 6 additions & 1 deletion e2e-tests/src/types/scheduling-goal.d.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
type SchedulingDslTypesResponse = {
reason: string;
status: 'failure' | 'success';
typescript: string;
typescriptFiles: TypescriptFile[];
};

type TypescriptFile = {
filePath: string;
content: string;
}

type SchedulingGoal = {
analyses: SchedulingGoalAnalysis[];
author: string | null;
Expand Down
13 changes: 13 additions & 0 deletions e2e-tests/src/utilities/gql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,19 @@ const gql = {
}
`,

GET_SCHEDULING_DSL_TYPESCRIPT: `#graphql
query GetSchedulingDslTypeScript($missionModelId: Int!) {
schedulingDslTypescript(missionModelId: $missionModelId) {
reason
status
typescriptFiles {
filePath
content
}
}
}
`,

DELETE_PLAN: `#graphql
mutation DeletePlan($id: Int!) {
deletePlan: delete_plan_by_pk(id: $id) {
Expand Down
6 changes: 6 additions & 0 deletions e2e-tests/src/utilities/requests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,12 @@ const req = {
return specification_id;
},

async getSchedulingDslTypeScript(request: APIRequestContext, missionModelId: number): Promise<SchedulingDslTypesResponse> {
const data = await req.hasura(request, gql.GET_SCHEDULING_DSL_TYPESCRIPT, { missionModelId: missionModelId });
const { schedulingDslTypescript } = data;
return schedulingDslTypescript;
},

async deletePlan(request: APIRequestContext, id: number){
const data = await req.hasura(request, gql.DELETE_PLAN, { id: id })
const { deletePlan } = data;
Expand Down

0 comments on commit 7b85970

Please sign in to comment.