Skip to content

Commit

Permalink
add idleRecordingDuration and introRecordingText
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronshiel committed May 2, 2024
1 parent d9c3a75 commit 173662a
Show file tree
Hide file tree
Showing 6 changed files with 93 additions and 37 deletions.
2 changes: 2 additions & 0 deletions node/src/gql/mutation/me/create-mentor-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ export const mentorConfigCreateUpdate = {
completeSubjectsNotificationText:
args.mentorConfig.completeSubjectsNotificationText,
recordTimeLimitSeconds: args.mentorConfig.recordTimeLimitSeconds,
idleRecordingDuration: args.mentorConfig.idleRecordingDuration,
introRecordingText: args.mentorConfig.introRecordingText,
},
},
{
Expand Down
8 changes: 8 additions & 0 deletions node/src/models/MentorConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ export interface MentorConfig extends Document {
disableLevelProgressDisplay: boolean;
completeSubjectsNotificationText: string;
recordTimeLimitSeconds: number;
idleRecordingDuration: number;
introRecordingText: string;
}

export const MentorConfigSchema = new Schema(
Expand All @@ -59,6 +61,8 @@ export const MentorConfigSchema = new Schema(
disableLevelProgressDisplay: { type: Boolean, default: false },
completeSubjectsNotificationText: { type: String, default: '' },
recordTimeLimitSeconds: { type: Number, default: 0 },
idleRecordingDuration: { type: Number, default: 10 },
introRecordingText: { type: String, default: '' },
},
{ timestamps: true, collation: { locale: 'en', strength: 2 } }
);
Expand All @@ -83,6 +87,8 @@ export const MentorConfigInputType = new GraphQLInputObjectType({
disableLevelProgressDisplay: { type: GraphQLBoolean },
completeSubjectsNotificationText: { type: GraphQLString },
recordTimeLimitSeconds: { type: GraphQLInt },
idleRecordingDuration: { type: GraphQLInt },
introRecordingText: { type: GraphQLString },
},
});

Expand All @@ -105,6 +111,8 @@ export const MentorConfigType = new GraphQLObjectType({
disableLevelProgressDisplay: { type: GraphQLBoolean },
completeSubjectsNotificationText: { type: GraphQLString },
recordTimeLimitSeconds: { type: GraphQLInt },
idleRecordingDuration: { type: GraphQLInt },
introRecordingText: { type: GraphQLString },
},
});

Expand Down
1 change: 1 addition & 0 deletions node/test/fixtures/mongodb/data-default.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ module.exports = {
lockedToSubjects: true,
publiclyVisible: true,
mentorType: 'CHAT',
introRecordingText: 'TestIntroRecordingText',
orgPermissions: [
{
org: ObjectId('511111111111111111111111'),
Expand Down
12 changes: 12 additions & 0 deletions node/test/graphql/mutation/me/create-mentor-config.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ describe('Create Mentor Config', () => {
disableLevelProgressDisplay
completeSubjectsNotificationText
recordTimeLimitSeconds
idleRecordingDuration
introRecordingText
}
}
}`,
Expand Down Expand Up @@ -109,6 +111,8 @@ describe('Create Mentor Config', () => {
completeSubjectsNotificationText:
'TestCompleteSubjectsNotificationText',
recordTimeLimitSeconds: 100,
idleRecordingDuration: 10,
introRecordingText: 'TestIntroRecordingText',
},
},
});
Expand Down Expand Up @@ -140,6 +144,8 @@ describe('Create Mentor Config', () => {
disableLevelProgressDisplay
completeSubjectsNotificationText
recordTimeLimitSeconds
idleRecordingDuration
introRecordingText
}
}`,
variables: {
Expand Down Expand Up @@ -201,5 +207,11 @@ describe('Create Mentor Config', () => {
expect(response2.body.data.fetchMentorConfig.lockedToSubjects).to.equal(
true
);
expect(
response2.body.data.fetchMentorConfig.idleRecordingDuration
).to.equal(10);
expect(response2.body.data.fetchMentorConfig.introRecordingText).to.equal(
'TestIntroRecordingText'
);
});
});
70 changes: 70 additions & 0 deletions node/test/graphql/query/mentor-config.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
/*
This software is Copyright ©️ 2020 The University of Southern California. All Rights Reserved.
Permission to use, copy, modify, and distribute this software and its documentation for educational, research and non-profit purposes, without fee, and without a written agreement is hereby granted, provided that the above copyright notice and subject to the full license file found in the root of this software deliverable. Permission to make commercial use of this software may be obtained by contacting: USC Stevens Center for Innovation University of Southern California 1150 S. Olive Street, Suite 2300, Los Angeles, CA 90115, USA Email: [email protected]
The full terms of this copyright and license should always be found in the root directory of this software deliverable as "license.txt" and if these terms are not found with this software, please contact the USC Stevens Center for the full license.
*/

import createApp, { appStart, appStop } from 'app';
import { expect } from 'chai';
import { Express } from 'express';
import { describe } from 'mocha';
import mongoUnit from 'mongo-unit';
import request from 'supertest';
import { getToken } from '../../helpers';

describe('mentor config query', () => {
let app: Express;

beforeEach(async () => {
await mongoUnit.load(require('test/fixtures/mongodb/data-default.js'));
app = await createApp();
await appStart();
});

afterEach(async () => {
await appStop();
await mongoUnit.drop();
});

it('gets lockdown config from mentor', async () => {
const response = await request(app)
.post('/graphql')
.send({
query: `query {
mentor(id: "5ffdf41a1ee2c62119991114") {
mentorConfig {
configId
subjects
publiclyVisible
idleRecordingDuration
introRecordingText
orgPermissions{
org
viewPermission
editPermission
}
}
}
}
`,
});
expect(response.status).to.equal(200);
expect(response.body.data.mentor).to.eql({
mentorConfig: {
configId: '2023TestConfig',
subjects: ['5ffdf41a1ee2c62320b49eb3'],
publiclyVisible: true,
idleRecordingDuration: 10,
introRecordingText: 'TestIntroRecordingText',
orgPermissions: [
{
org: '511111111111111111111111',
viewPermission: 'HIDDEN',
editPermission: 'HIDDEN',
},
],
},
});
});
});
37 changes: 0 additions & 37 deletions node/test/graphql/query/mentor.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -992,41 +992,4 @@ describe('mentor', () => {
],
});
});

it('gets lockdown config from mentor', async () => {
const response = await request(app)
.post('/graphql')
.send({
query: `query {
mentor(id: "5ffdf41a1ee2c62119991114") {
mentorConfig {
configId
subjects
publiclyVisible
orgPermissions{
org
viewPermission
editPermission
}
}
}
}
`,
});
expect(response.status).to.equal(200);
expect(response.body.data.mentor).to.eql({
mentorConfig: {
configId: '2023TestConfig',
subjects: ['5ffdf41a1ee2c62320b49eb3'],
publiclyVisible: true,
orgPermissions: [
{
org: '511111111111111111111111',
viewPermission: 'HIDDEN',
editPermission: 'HIDDEN',
},
],
},
});
});
});

0 comments on commit 173662a

Please sign in to comment.