Skip to content
This repository has been archived by the owner on Mar 7, 2023. It is now read-only.

Commit

Permalink
Merge branch 'dev' into 218-tolerance
Browse files Browse the repository at this point in the history
  • Loading branch information
jbuget committed Mar 1, 2017
2 parents a36fc57 + 6cbdfc5 commit 7ebaa8b
Show file tree
Hide file tree
Showing 22 changed files with 615 additions and 688 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# PIX Changelog
## 1.4.1 (23/02/2017)
- [#309](https://github.com/sgmap/pix/pull/309) [BUGFIX] Correction d'un bug sur la progressbar

## 1.4.0 (22/02/2017)

Expand Down
60 changes: 30 additions & 30 deletions api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,40 +17,40 @@
},
"homepage": "https://github.com/sgmap/pix-api#readme",
"dependencies": {
"airtable": "0.4.3",
"airtable": "0.4.4",
"blipp": "^2.3.0",
"bookshelf": "^0.10.2",
"boom": "^4.2.0",
"bunyan": "^1.8.5",
"catbox": "^7.1.2",
"catbox-memory": "^2.0.4",
"faker": "3.1.0",
"bookshelf": "0.10.3",
"boom": "4.2.0",
"bunyan": "1.8.5",
"catbox": "7.1.3",
"catbox-memory": "2.0.4",
"faker": "4.1.0",
"fast-levenshtein": "2.0.6",
"good": "^7.0.2",
"good-console": "^6.3.1",
"good-squeeze": "^5.0.1",
"hapi": "^15.2.0",
"hapi-swagger": "^7.4.0",
"inert": "^4.0.2",
"knex": "^0.12.6",
"lodash": "^4.17.2",
"moment": "^2.17.0",
"node-cache": "^4.1.0",
"path": "^0.12.7",
"pg": "^6.1.0",
"sqlite3": "^3.1.8",
"vision": "^4.1.0"
"good": "7.1.0",
"good-console": "6.4.0",
"good-squeeze": "5.0.1",
"hapi": "16.1.0",
"hapi-swagger": "7.7.0",
"inert": "4.1.0",
"knex": "0.12.7",
"lodash": "4.17.4",
"moment": "2.17.1",
"node-cache": "4.1.1",
"path": "0.12.7",
"pg": "6.1.2",
"sqlite3": "3.1.8",
"vision": "4.1.1"
},
"devDependencies": {
"chai": "^3.5.0",
"chai-as-promised": "^6.0.0",
"eslint": "^3.11.0",
"istanbul": "^0.4.5",
"mocha": "^3.2.0",
"nock": "^9.0.2",
"nodemon": "^1.11.0",
"sinon": "^1.17.6",
"sinon-as-promised": "^4.0.2"
"chai": "3.5.0",
"chai-as-promised": "6.0.0",
"eslint": "3.16.0",
"istanbul": "0.4.5",
"mocha": "3.2.0",
"nock": "9.0.6",
"nodemon": "1.11.0",
"sinon": "1.17.7",
"sinon-as-promised": "4.0.2"
},
"scripts": {
"help": "./scripts/help.sh",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,18 +60,18 @@ describe('Acceptance | API | Assessments GET (non adaptive)', function () {

describe('(non-adaptive) GET /api/assessments/:assessment_id/next', function () {

let inserted_assessment_id = null;
let insertedAssessmentId = null;

const inserted_assessment = {
const insertedAssessment = {
userName: 'John Doe',
userEmail: 'john.doe@mailmail.com',
courseId: 'a_non_adaptive_course_id'
};

beforeEach(function (done) {
knex('assessments').delete().then(() => {
knex('assessments').insert([inserted_assessment]).then((rows) => {
inserted_assessment_id = rows[0];
knex('assessments').insert([insertedAssessment]).then((rows) => {
insertedAssessmentId = rows[0];
done();
});
});
Expand All @@ -82,15 +82,15 @@ describe('Acceptance | API | Assessments GET (non adaptive)', function () {
});

it('should return 200 HTTP status code', function (done) {
const options = { method: 'GET', url: '/api/assessments/' + inserted_assessment_id + '/next' };
const options = { method: 'GET', url: '/api/assessments/' + insertedAssessmentId + '/next' };
server.inject(options, (response) => {
expect(response.statusCode).to.equal(200);
done();
});
});

it('should return application/json', function (done) {
const options = { method: 'GET', url: '/api/assessments/' + inserted_assessment_id + '/next' };
const options = { method: 'GET', url: '/api/assessments/' + insertedAssessmentId + '/next' };
server.inject(options, (response) => {
const contentType = response.headers['content-type'];
expect(contentType).to.contain('application/json');
Expand All @@ -99,23 +99,31 @@ describe('Acceptance | API | Assessments GET (non adaptive)', function () {
});

it('should return the first challenge if no challenge specified', function (done) {
const options = { method: 'GET', url: '/api/assessments/' + inserted_assessment_id + '/next' };
const options = { method: 'GET', url: '/api/assessments/' + insertedAssessmentId + '/next' };
server.inject(options, (response) => {
expect(response.result.data.id).to.equal('first_challenge');
done();
});
});

it('should return the next challenge otherwise', function (done) {
const options = { method: 'GET', url: '/api/assessments/' + inserted_assessment_id + '/next/first_challenge' };
const options = { method: 'GET', url: '/api/assessments/' + insertedAssessmentId + '/next/first_challenge' };
server.inject(options, (response) => {
expect(response.result.data.id).to.equal('second_challenge');
done();
});
});

it('should return null if reached the last challenge of the course', function (done) {
const options = { method: 'GET', url: '/api/assessments/' + inserted_assessment_id + '/next/second_challenge' };
const options = { method: 'GET', url: '/api/assessments/' + insertedAssessmentId + '/next/second_challenge' };
server.inject(options, (response) => {
expect(response.result).to.equal('null');
done();
});
});

it('should return null if reached the last challenge of the course', function (done) {
const options = { method: 'GET', url: '/api/assessments/' + insertedAssessmentId + '/next/second_challenge' };
server.inject(options, (response) => {
expect(response.result).to.equal('null');
done();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ describe('Acceptance | API | Solutions of Assessments', function () {
knex.seed.run().then(() => {
nock('https://api.airtable.com')
.get('/v0/test-base/Tests/non_adaptive_course_id') // XXX cf. issue #204, there may be a conflict with course-controller_test
.query(true)
.times(4)
.reply(200, {
'id': 'non_adaptive_course_id',
Expand All @@ -23,6 +24,7 @@ describe('Acceptance | API | Solutions of Assessments', function () {
);
nock('https://api.airtable.com')
.get('/v0/test-base/Tests/adaptive_course_id')
.query(true)
.times(4)
.reply(200, {
'id': 'adaptive_course_id',
Expand All @@ -39,6 +41,7 @@ describe('Acceptance | API | Solutions of Assessments', function () {
);
nock('https://api.airtable.com')
.get('/v0/test-base/Epreuves/first_challenge')
.query(true)
.times(3)
.reply(200, {
'id': 'first_challenge',
Expand All @@ -49,6 +52,7 @@ describe('Acceptance | API | Solutions of Assessments', function () {
);
nock('https://api.airtable.com')
.get('/v0/test-base/Epreuves/second_challenge')
.query(true)
.reply(200, {
'id': 'second_challenge',
'fields': {
Expand All @@ -58,6 +62,7 @@ describe('Acceptance | API | Solutions of Assessments', function () {
);
nock('https://api.airtable.com')
.get('/v0/test-base/Epreuves/third_challenge')
.query(true)
.reply(200, {
'id': 'third_challenge',
'fields': {
Expand Down Expand Up @@ -308,4 +313,4 @@ describe('Acceptance | API | Solutions of Assessments', function () {
});
});

});
});

0 comments on commit 7ebaa8b

Please sign in to comment.