@coorpacademy/app-review 0.5.0 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,7 +7,7 @@ export const VIEWS = {
7
7
  };
8
8
  export const slideIndexes = ['0', '1', '2', '3', '4'];
9
9
  export const getProgressionSlidesRefs = (progression) => {
10
- if (progression.state.step.current < 5) {
10
+ if (progression.state.step.current <= 5) {
11
11
  const slideRef = progression.state.nextContent.ref;
12
12
  return concat(progression.state.slides, [slideRef]);
13
13
  }
@@ -7,7 +7,7 @@ export var VIEWS = {
7
7
  };
8
8
  export var slideIndexes = ['0', '1', '2', '3', '4'];
9
9
  export var getProgressionSlidesRefs = function (progression) {
10
- if (progression.state.step.current < 5) {
10
+ if (progression.state.step.current <= 5) {
11
11
  var slideRef = progression.state.nextContent.ref;
12
12
  return concat(progression.state.slides, [slideRef]);
13
13
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coorpacademy/app-review",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "description": "",
5
5
  "engines": {
6
6
  "node": ">=16.15.0"
@@ -9,7 +9,7 @@
9
9
  "scripts": {
10
10
  "static": "webpack --progress --output-path static/dist",
11
11
  "poststatic": "cp sandbox/index.html static/index.html",
12
- "start": "cross-env BABEL_ENV=es webpack-dev-server --content-base sandbox --host 0.0.0.0 --history-api-fallback true --hot true",
12
+ "start": "cross-env BABEL_ENV=es webpack-dev-server",
13
13
  "prepare": "npm run clean && npm run build --production",
14
14
  "build:commonjs": "tsc -p tsconfig.lib.json",
15
15
  "build:es": "tsc -p tsconfig.es.json",
@@ -43,11 +43,11 @@
43
43
  "./package.json": "./package.json"
44
44
  },
45
45
  "dependencies": {
46
- "@coorpacademy/components": "10.23.8",
46
+ "@coorpacademy/components": "10.24.0",
47
47
  "@coorpacademy/redux-task": "^1.1.5",
48
48
  "cross-fetch": "^3.1.5",
49
49
  "jwt-decode": "^3.1.2",
50
- "react-redux": "7.2.8",
50
+ "react-redux": "^7.2.9",
51
51
  "redux": "^4.2.0",
52
52
  "redux-thunk": "^2.4.1"
53
53
  },
@@ -58,7 +58,7 @@
58
58
  "devDependencies": {
59
59
  "@coorpacademy/css-modules-require-hook": "2.1.5",
60
60
  "@coorpacademy/eslint-plugin-coorpacademy": "^11.0.0",
61
- "@coorpacademy/webpack-config": "10.0.4",
61
+ "@coorpacademy/webpack-config": "10.0.5",
62
62
  "@testing-library/react": "^12.1.5",
63
63
  "@types/lodash": "^4.14.182",
64
64
  "@typescript-eslint/eslint-plugin": "^5.28.0",
@@ -66,17 +66,16 @@
66
66
  "ava": "^4.3.0",
67
67
  "browser-env": "^3.3.0",
68
68
  "concurrently": "^5.2.0",
69
- "dotenv": "^16.0.1",
70
69
  "eslint": "^8.18.0",
71
70
  "eslint-plugin-react-hooks": "^4.6.0",
72
71
  "nock": "^13.2.9",
73
72
  "react-dom": "^17.0.2",
74
- "ts-loader": "^8.2.0",
73
+ "ts-loader": "^9.4.1",
75
74
  "ts-node": "^10.9.1",
76
75
  "typescript": "^4.7.4",
77
- "webpack": "^4.43.0",
78
- "webpack-cli": "^3.3.11",
79
- "webpack-dev-server": "^3.11.0"
76
+ "webpack": "^5.74.0",
77
+ "webpack-cli": "^4.10.0",
78
+ "webpack-dev-server": "^4.11.1"
80
79
  },
81
- "gitHead": "ef2f2340a0169672d5880e8fb9900cd7c7ebf12c"
80
+ "gitHead": "abad47a390275389da6de707a0473141eab843ac"
82
81
  }
@@ -17,7 +17,7 @@ export const slideIndexes = ['0', '1', '2', '3', '4'] as const;
17
17
  export type SlideIndexes = typeof slideIndexes[number];
18
18
 
19
19
  export const getProgressionSlidesRefs = (progression: ProgressionFromAPI): string[] => {
20
- if (progression.state.step.current < 5) {
20
+ if (progression.state.step.current <= 5) {
21
21
  const slideRef = progression.state.nextContent.ref;
22
22
  return concat(progression.state.slides, [slideRef]);
23
23
  }
@@ -0,0 +1,35 @@
1
+ import test from 'ava';
2
+ import {
3
+ postAnswerResponses,
4
+ postProgressionResponse,
5
+ progressionSlideWithPendingSlide
6
+ } from '../../test/util/services.mock';
7
+ import {templateSlide} from '../../views/slides/test/fixtures/template';
8
+ import {getProgressionSlidesRefs} from '..';
9
+
10
+ test('should return first slide for a created slide', t => {
11
+ const slides = getProgressionSlidesRefs(postProgressionResponse);
12
+ t.deepEqual(slides, ['sli_VJYjJnJhg']);
13
+ });
14
+
15
+ test('should return all 5 slides when user is going to answer the 5th slide', t => {
16
+ const slides = getProgressionSlidesRefs(postAnswerResponses[templateSlide._id]);
17
+ t.deepEqual(slides, [
18
+ 'sli_VJYjJnJhg',
19
+ 'sli_VkSQroQnx',
20
+ 'sli_N1XACJobn',
21
+ 'sli_VkAzsCLKb',
22
+ 'sli_N13-hG3kX'
23
+ ]);
24
+ });
25
+
26
+ test('should return all 5 slides when progression has a nextContent ref that is a pending slide', t => {
27
+ const slides = getProgressionSlidesRefs(progressionSlideWithPendingSlide);
28
+ t.deepEqual(slides, [
29
+ 'sli_VJYjJnJhg',
30
+ 'sli_VkSQroQnx',
31
+ 'sli_N1XACJobn',
32
+ 'sli_VkAzsCLKb',
33
+ 'sli_N13-hG3kX'
34
+ ]);
35
+ });