Skip to content

Commit 77da09d

Browse files
committedMar 25, 2025
tech(api): delete some redundant acceptance test for demo
1 parent b03ea13 commit 77da09d

File tree

1 file changed

+8
-42
lines changed

1 file changed

+8
-42
lines changed
 

‎api/tests/shared/acceptance/application/assessments/assessment-controller-get-next-challenge-for-demo_test.js

+8-42
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ describe('Acceptance | API | assessment-controller-get-next-challenge-for-demo',
5252
describe('(demo) GET /api/assessments/:assessment_id/next', function () {
5353
const assessmentId = 1;
5454

55-
context('when no challenge is answered', function () {
55+
context('when next challenge found', function () {
5656
beforeEach(function () {
5757
databaseBuilder.factory.buildAssessment({
5858
id: assessmentId,
@@ -62,50 +62,18 @@ describe('Acceptance | API | assessment-controller-get-next-challenge-for-demo',
6262
return databaseBuilder.commit();
6363
});
6464

65-
it('should return 200 HTTP status code', function () {
65+
it('should return 200 HTTP status code', async function () {
6666
// given
6767
const options = {
6868
method: 'GET',
6969
url: '/api/assessments/' + assessmentId + '/next',
7070
};
7171

7272
// when
73-
return server.inject(options).then((response) => {
74-
expect(response.statusCode).to.equal(200);
75-
});
76-
});
77-
78-
it('should return application/json', function () {
79-
// given
80-
const options = {
81-
method: 'GET',
82-
url: '/api/assessments/' + assessmentId + '/next',
83-
};
84-
85-
// when
86-
const promise = server.inject(options);
87-
88-
// then
89-
return promise.then((response) => {
90-
const contentType = response.headers['content-type'];
91-
expect(contentType).to.contain('application/json');
92-
});
93-
});
94-
95-
it('should return the first challenge if none already answered', function () {
96-
// given
97-
const options = {
98-
method: 'GET',
99-
url: '/api/assessments/' + assessmentId + '/next',
100-
};
101-
102-
// when
103-
const promise = server.inject(options);
104-
105-
// then
106-
return promise.then((response) => {
107-
expect(response.result.data.id).to.equal('first_challenge');
108-
});
73+
const response = await server.inject(options);
74+
expect(response.statusCode).to.equal(200);
75+
expect(response.headers['content-type']).to.contain('application/json');
76+
expect(response.result.data.id).to.equal('first_challenge');
10977
});
11078
});
11179

@@ -128,12 +96,10 @@ describe('Acceptance | API | assessment-controller-get-next-challenge-for-demo',
12896
};
12997

13098
// when
131-
const promise = server.inject(options);
99+
const response = await server.inject(options);
132100

133101
// then
134-
return promise.then((response) => {
135-
expect(response.result.data.id).to.equal('second_challenge');
136-
});
102+
expect(response.result.data.id).to.equal('second_challenge');
137103
});
138104
});
139105

0 commit comments

Comments
 (0)