czapp-shared 1.0.34 → 1.0.36
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.
- package/dist/index.d.mts +24 -1
- package/dist/index.d.ts +24 -1
- package/dist/index.js +7 -0
- package/dist/index.mjs +6 -0
- package/package.json +1 -1
- package/src/concrete/vocabCheck.ts +15 -0
- package/src/design/api.ts +5 -0
- package/src/design/types.ts +11 -0
- package/test/vocabCheck.test.ts +31 -1
package/dist/index.d.mts
CHANGED
|
@@ -108,6 +108,16 @@ interface IVocabCheckActivity {
|
|
|
108
108
|
flashcardCount: number;
|
|
109
109
|
testQuestionCount: number;
|
|
110
110
|
}
|
|
111
|
+
/**
|
|
112
|
+
* A user's lexeme pair counts per LearningStageGroup as recorded on a given day. learningCount
|
|
113
|
+
* includes NEW pairs, matching the LearningStageGroup.LEARNING grouping.
|
|
114
|
+
*/
|
|
115
|
+
interface IProgressHistoryDay {
|
|
116
|
+
date: DateString;
|
|
117
|
+
queuedCount: number;
|
|
118
|
+
learningCount: number;
|
|
119
|
+
retiredCount: number;
|
|
120
|
+
}
|
|
111
121
|
type MySQLDate = `${number}-${number}-${number} ${number}:${number}:${number}`;
|
|
112
122
|
type DateString = `${number}-${string}-${string}`;
|
|
113
123
|
declare enum ReminderFrequency {
|
|
@@ -225,6 +235,14 @@ type Streaks = {
|
|
|
225
235
|
flashcardStreak: number;
|
|
226
236
|
testStreak: number;
|
|
227
237
|
};
|
|
238
|
+
/**
|
|
239
|
+
* @name isFinalTest
|
|
240
|
+
* @description A lexeme pair in the LEARNING stage is shown once per flashcard review session
|
|
241
|
+
* across a 10-session cycle starting from the session where it was first marked known
|
|
242
|
+
* (firstKnownSessionDigit). This returns true when the given session count lands on the last
|
|
243
|
+
* session of that cycle, at which point the pair should be promoted to RETIRED.
|
|
244
|
+
*/
|
|
245
|
+
declare const isFinalTest: (firstKnownSessionDigit: number, testsCompletedCount: number) => boolean;
|
|
228
246
|
declare const deriveStreakFromVocabCheckActivity: (activity: IVocabCheckActivity[], today: DateString) => Streaks;
|
|
229
247
|
|
|
230
248
|
interface IActivityCount {
|
|
@@ -284,6 +302,7 @@ declare enum ApiPath {
|
|
|
284
302
|
LEXEME_PAIR_FAMILIARITY = "/lexemePair/:czId/:enId/:familiarity",
|
|
285
303
|
LEXEME_PAIR_COUNT = "/lexemePairCount",
|
|
286
304
|
LEXEME_PAIR_RECYCLE = "/lexemePair/recycle/:czId/:enId",
|
|
305
|
+
PROGRESS_HISTORY = "/progressHistory/:endDate/:noOfDays",
|
|
287
306
|
PUSH_TOKEN = "/user/pushToken",
|
|
288
307
|
SIGN_IN = "/signIn",
|
|
289
308
|
SIGN_OUT = "/signOut",
|
|
@@ -399,6 +418,10 @@ interface SelectVocabCheckActivityParams {
|
|
|
399
418
|
endDate: DateString;
|
|
400
419
|
noOfDays: number;
|
|
401
420
|
}
|
|
421
|
+
interface SelectProgressHistoryParams {
|
|
422
|
+
endDate: DateString;
|
|
423
|
+
noOfDays: number;
|
|
424
|
+
}
|
|
402
425
|
/**
|
|
403
426
|
* Response payloads
|
|
404
427
|
*/
|
|
@@ -447,4 +470,4 @@ type DeeplTranslation = {
|
|
|
447
470
|
}>;
|
|
448
471
|
};
|
|
449
472
|
|
|
450
|
-
export { ApiMethod, ApiPath, AppError, type AutologinRequestBody, ClientPlatform, type ControllerResponse, type DateString, type DeeplTranslation, type DeleteLexemePairRequestParams, Familiarity, type HeatMapParams, type HeatMapResponseData, HttpStatusCode, type IActivityCount, type ICount, type ILexeme, type ILexemeIdPair, type ILexemeLearningInfo, type ILexemePair, type ILexemePairTexts, type ISession, type ITestResult, type IUserData, type IVocabCheckActivity, type InsertOrUpdateRequestBody, type InsertOrUpdateResponseData, LEARNING_STAGES_IN_GROUP, Language, LearningStage, LearningStageGroup, Lexeme, LexemePair, type LexemePairRequestBody, type LexemePairWithLang, type MySQLDate, Progress, type RecycleLexemePairParams, type RegisterPushTokenRequestBody, ReminderFrequency, type ResetTestUserParams, type Result, Scenario, type SelectAllTranslationsParams, type SelectLexemeCountParams, type SelectLexemePairParams, type SelectLexemePairsByTextParams, type SelectLexemesParams, type SelectTestLexemesParams, type SelectVocabCheckActivityParams, type SignInRequestBody, type SignInResponseData, type Streaks, type TestCompleteRequestBody, type TestCompleteResponseData, type TestInitRequestBody, type TestInitResponseData, type TranslationRequestBody, type TranslationResponseData, type UpdateLexemePairFamiliarityParams, type UpdateOnboardingStatusRequestBody, type UpdateUserRequestBody, VocabCheckType, convertJSDateStringToMySQLDate, dateDifferenceInDays, deriveStreakFromVocabCheckActivity, getFormattedDate, getMysqlDateIgnoreTZ, isClientDateTooFarFromServerDate, isExpired, isLearningStageGroup, isStringContainingInteger, isThePreviousDay, isTheSameDay, isValidJsDateString, isValidMysqlDateString, parameterReplace };
|
|
473
|
+
export { ApiMethod, ApiPath, AppError, type AutologinRequestBody, ClientPlatform, type ControllerResponse, type DateString, type DeeplTranslation, type DeleteLexemePairRequestParams, Familiarity, type HeatMapParams, type HeatMapResponseData, HttpStatusCode, type IActivityCount, type ICount, type ILexeme, type ILexemeIdPair, type ILexemeLearningInfo, type ILexemePair, type ILexemePairTexts, type IProgressHistoryDay, type ISession, type ITestResult, type IUserData, type IVocabCheckActivity, type InsertOrUpdateRequestBody, type InsertOrUpdateResponseData, LEARNING_STAGES_IN_GROUP, Language, LearningStage, LearningStageGroup, Lexeme, LexemePair, type LexemePairRequestBody, type LexemePairWithLang, type MySQLDate, Progress, type RecycleLexemePairParams, type RegisterPushTokenRequestBody, ReminderFrequency, type ResetTestUserParams, type Result, Scenario, type SelectAllTranslationsParams, type SelectLexemeCountParams, type SelectLexemePairParams, type SelectLexemePairsByTextParams, type SelectLexemesParams, type SelectProgressHistoryParams, type SelectTestLexemesParams, type SelectVocabCheckActivityParams, type SignInRequestBody, type SignInResponseData, type Streaks, type TestCompleteRequestBody, type TestCompleteResponseData, type TestInitRequestBody, type TestInitResponseData, type TranslationRequestBody, type TranslationResponseData, type UpdateLexemePairFamiliarityParams, type UpdateOnboardingStatusRequestBody, type UpdateUserRequestBody, VocabCheckType, convertJSDateStringToMySQLDate, dateDifferenceInDays, deriveStreakFromVocabCheckActivity, getFormattedDate, getMysqlDateIgnoreTZ, isClientDateTooFarFromServerDate, isExpired, isFinalTest, isLearningStageGroup, isStringContainingInteger, isThePreviousDay, isTheSameDay, isValidJsDateString, isValidMysqlDateString, parameterReplace };
|
package/dist/index.d.ts
CHANGED
|
@@ -108,6 +108,16 @@ interface IVocabCheckActivity {
|
|
|
108
108
|
flashcardCount: number;
|
|
109
109
|
testQuestionCount: number;
|
|
110
110
|
}
|
|
111
|
+
/**
|
|
112
|
+
* A user's lexeme pair counts per LearningStageGroup as recorded on a given day. learningCount
|
|
113
|
+
* includes NEW pairs, matching the LearningStageGroup.LEARNING grouping.
|
|
114
|
+
*/
|
|
115
|
+
interface IProgressHistoryDay {
|
|
116
|
+
date: DateString;
|
|
117
|
+
queuedCount: number;
|
|
118
|
+
learningCount: number;
|
|
119
|
+
retiredCount: number;
|
|
120
|
+
}
|
|
111
121
|
type MySQLDate = `${number}-${number}-${number} ${number}:${number}:${number}`;
|
|
112
122
|
type DateString = `${number}-${string}-${string}`;
|
|
113
123
|
declare enum ReminderFrequency {
|
|
@@ -225,6 +235,14 @@ type Streaks = {
|
|
|
225
235
|
flashcardStreak: number;
|
|
226
236
|
testStreak: number;
|
|
227
237
|
};
|
|
238
|
+
/**
|
|
239
|
+
* @name isFinalTest
|
|
240
|
+
* @description A lexeme pair in the LEARNING stage is shown once per flashcard review session
|
|
241
|
+
* across a 10-session cycle starting from the session where it was first marked known
|
|
242
|
+
* (firstKnownSessionDigit). This returns true when the given session count lands on the last
|
|
243
|
+
* session of that cycle, at which point the pair should be promoted to RETIRED.
|
|
244
|
+
*/
|
|
245
|
+
declare const isFinalTest: (firstKnownSessionDigit: number, testsCompletedCount: number) => boolean;
|
|
228
246
|
declare const deriveStreakFromVocabCheckActivity: (activity: IVocabCheckActivity[], today: DateString) => Streaks;
|
|
229
247
|
|
|
230
248
|
interface IActivityCount {
|
|
@@ -284,6 +302,7 @@ declare enum ApiPath {
|
|
|
284
302
|
LEXEME_PAIR_FAMILIARITY = "/lexemePair/:czId/:enId/:familiarity",
|
|
285
303
|
LEXEME_PAIR_COUNT = "/lexemePairCount",
|
|
286
304
|
LEXEME_PAIR_RECYCLE = "/lexemePair/recycle/:czId/:enId",
|
|
305
|
+
PROGRESS_HISTORY = "/progressHistory/:endDate/:noOfDays",
|
|
287
306
|
PUSH_TOKEN = "/user/pushToken",
|
|
288
307
|
SIGN_IN = "/signIn",
|
|
289
308
|
SIGN_OUT = "/signOut",
|
|
@@ -399,6 +418,10 @@ interface SelectVocabCheckActivityParams {
|
|
|
399
418
|
endDate: DateString;
|
|
400
419
|
noOfDays: number;
|
|
401
420
|
}
|
|
421
|
+
interface SelectProgressHistoryParams {
|
|
422
|
+
endDate: DateString;
|
|
423
|
+
noOfDays: number;
|
|
424
|
+
}
|
|
402
425
|
/**
|
|
403
426
|
* Response payloads
|
|
404
427
|
*/
|
|
@@ -447,4 +470,4 @@ type DeeplTranslation = {
|
|
|
447
470
|
}>;
|
|
448
471
|
};
|
|
449
472
|
|
|
450
|
-
export { ApiMethod, ApiPath, AppError, type AutologinRequestBody, ClientPlatform, type ControllerResponse, type DateString, type DeeplTranslation, type DeleteLexemePairRequestParams, Familiarity, type HeatMapParams, type HeatMapResponseData, HttpStatusCode, type IActivityCount, type ICount, type ILexeme, type ILexemeIdPair, type ILexemeLearningInfo, type ILexemePair, type ILexemePairTexts, type ISession, type ITestResult, type IUserData, type IVocabCheckActivity, type InsertOrUpdateRequestBody, type InsertOrUpdateResponseData, LEARNING_STAGES_IN_GROUP, Language, LearningStage, LearningStageGroup, Lexeme, LexemePair, type LexemePairRequestBody, type LexemePairWithLang, type MySQLDate, Progress, type RecycleLexemePairParams, type RegisterPushTokenRequestBody, ReminderFrequency, type ResetTestUserParams, type Result, Scenario, type SelectAllTranslationsParams, type SelectLexemeCountParams, type SelectLexemePairParams, type SelectLexemePairsByTextParams, type SelectLexemesParams, type SelectTestLexemesParams, type SelectVocabCheckActivityParams, type SignInRequestBody, type SignInResponseData, type Streaks, type TestCompleteRequestBody, type TestCompleteResponseData, type TestInitRequestBody, type TestInitResponseData, type TranslationRequestBody, type TranslationResponseData, type UpdateLexemePairFamiliarityParams, type UpdateOnboardingStatusRequestBody, type UpdateUserRequestBody, VocabCheckType, convertJSDateStringToMySQLDate, dateDifferenceInDays, deriveStreakFromVocabCheckActivity, getFormattedDate, getMysqlDateIgnoreTZ, isClientDateTooFarFromServerDate, isExpired, isLearningStageGroup, isStringContainingInteger, isThePreviousDay, isTheSameDay, isValidJsDateString, isValidMysqlDateString, parameterReplace };
|
|
473
|
+
export { ApiMethod, ApiPath, AppError, type AutologinRequestBody, ClientPlatform, type ControllerResponse, type DateString, type DeeplTranslation, type DeleteLexemePairRequestParams, Familiarity, type HeatMapParams, type HeatMapResponseData, HttpStatusCode, type IActivityCount, type ICount, type ILexeme, type ILexemeIdPair, type ILexemeLearningInfo, type ILexemePair, type ILexemePairTexts, type IProgressHistoryDay, type ISession, type ITestResult, type IUserData, type IVocabCheckActivity, type InsertOrUpdateRequestBody, type InsertOrUpdateResponseData, LEARNING_STAGES_IN_GROUP, Language, LearningStage, LearningStageGroup, Lexeme, LexemePair, type LexemePairRequestBody, type LexemePairWithLang, type MySQLDate, Progress, type RecycleLexemePairParams, type RegisterPushTokenRequestBody, ReminderFrequency, type ResetTestUserParams, type Result, Scenario, type SelectAllTranslationsParams, type SelectLexemeCountParams, type SelectLexemePairParams, type SelectLexemePairsByTextParams, type SelectLexemesParams, type SelectProgressHistoryParams, type SelectTestLexemesParams, type SelectVocabCheckActivityParams, type SignInRequestBody, type SignInResponseData, type Streaks, type TestCompleteRequestBody, type TestCompleteResponseData, type TestInitRequestBody, type TestInitResponseData, type TranslationRequestBody, type TranslationResponseData, type UpdateLexemePairFamiliarityParams, type UpdateOnboardingStatusRequestBody, type UpdateUserRequestBody, VocabCheckType, convertJSDateStringToMySQLDate, dateDifferenceInDays, deriveStreakFromVocabCheckActivity, getFormattedDate, getMysqlDateIgnoreTZ, isClientDateTooFarFromServerDate, isExpired, isFinalTest, isLearningStageGroup, isStringContainingInteger, isThePreviousDay, isTheSameDay, isValidJsDateString, isValidMysqlDateString, parameterReplace };
|
package/dist/index.js
CHANGED
|
@@ -42,6 +42,7 @@ __export(index_exports, {
|
|
|
42
42
|
getMysqlDateIgnoreTZ: () => getMysqlDateIgnoreTZ,
|
|
43
43
|
isClientDateTooFarFromServerDate: () => isClientDateTooFarFromServerDate,
|
|
44
44
|
isExpired: () => isExpired,
|
|
45
|
+
isFinalTest: () => isFinalTest,
|
|
45
46
|
isLearningStageGroup: () => isLearningStageGroup,
|
|
46
47
|
isStringContainingInteger: () => isStringContainingInteger,
|
|
47
48
|
isThePreviousDay: () => isThePreviousDay,
|
|
@@ -239,6 +240,10 @@ var parameterReplace = (path, params = []) => {
|
|
|
239
240
|
};
|
|
240
241
|
|
|
241
242
|
// src/concrete/vocabCheck.ts
|
|
243
|
+
var isFinalTest = (firstKnownSessionDigit, testsCompletedCount) => {
|
|
244
|
+
const currentSessionDigit = testsCompletedCount % 10;
|
|
245
|
+
return currentSessionDigit === (firstKnownSessionDigit + 9) % 10;
|
|
246
|
+
};
|
|
242
247
|
var deriveStreakFromVocabCheckActivity = (activity, today) => {
|
|
243
248
|
if (activity.length === 0) return { flashcardStreak: 0, testStreak: 0 };
|
|
244
249
|
let flashcardStreak = 0;
|
|
@@ -317,6 +322,7 @@ var ApiPath = /* @__PURE__ */ ((ApiPath2) => {
|
|
|
317
322
|
ApiPath2["LEXEME_PAIR_FAMILIARITY"] = "/lexemePair/:czId/:enId/:familiarity";
|
|
318
323
|
ApiPath2["LEXEME_PAIR_COUNT"] = "/lexemePairCount";
|
|
319
324
|
ApiPath2["LEXEME_PAIR_RECYCLE"] = "/lexemePair/recycle/:czId/:enId";
|
|
325
|
+
ApiPath2["PROGRESS_HISTORY"] = "/progressHistory/:endDate/:noOfDays";
|
|
320
326
|
ApiPath2["PUSH_TOKEN"] = "/user/pushToken";
|
|
321
327
|
ApiPath2["SIGN_IN"] = "/signIn";
|
|
322
328
|
ApiPath2["SIGN_OUT"] = "/signOut";
|
|
@@ -362,6 +368,7 @@ var ClientPlatform = /* @__PURE__ */ ((ClientPlatform2) => {
|
|
|
362
368
|
getMysqlDateIgnoreTZ,
|
|
363
369
|
isClientDateTooFarFromServerDate,
|
|
364
370
|
isExpired,
|
|
371
|
+
isFinalTest,
|
|
365
372
|
isLearningStageGroup,
|
|
366
373
|
isStringContainingInteger,
|
|
367
374
|
isThePreviousDay,
|
package/dist/index.mjs
CHANGED
|
@@ -185,6 +185,10 @@ var parameterReplace = (path, params = []) => {
|
|
|
185
185
|
};
|
|
186
186
|
|
|
187
187
|
// src/concrete/vocabCheck.ts
|
|
188
|
+
var isFinalTest = (firstKnownSessionDigit, testsCompletedCount) => {
|
|
189
|
+
const currentSessionDigit = testsCompletedCount % 10;
|
|
190
|
+
return currentSessionDigit === (firstKnownSessionDigit + 9) % 10;
|
|
191
|
+
};
|
|
188
192
|
var deriveStreakFromVocabCheckActivity = (activity, today) => {
|
|
189
193
|
if (activity.length === 0) return { flashcardStreak: 0, testStreak: 0 };
|
|
190
194
|
let flashcardStreak = 0;
|
|
@@ -263,6 +267,7 @@ var ApiPath = /* @__PURE__ */ ((ApiPath2) => {
|
|
|
263
267
|
ApiPath2["LEXEME_PAIR_FAMILIARITY"] = "/lexemePair/:czId/:enId/:familiarity";
|
|
264
268
|
ApiPath2["LEXEME_PAIR_COUNT"] = "/lexemePairCount";
|
|
265
269
|
ApiPath2["LEXEME_PAIR_RECYCLE"] = "/lexemePair/recycle/:czId/:enId";
|
|
270
|
+
ApiPath2["PROGRESS_HISTORY"] = "/progressHistory/:endDate/:noOfDays";
|
|
266
271
|
ApiPath2["PUSH_TOKEN"] = "/user/pushToken";
|
|
267
272
|
ApiPath2["SIGN_IN"] = "/signIn";
|
|
268
273
|
ApiPath2["SIGN_OUT"] = "/signOut";
|
|
@@ -307,6 +312,7 @@ export {
|
|
|
307
312
|
getMysqlDateIgnoreTZ,
|
|
308
313
|
isClientDateTooFarFromServerDate,
|
|
309
314
|
isExpired,
|
|
315
|
+
isFinalTest,
|
|
310
316
|
isLearningStageGroup,
|
|
311
317
|
isStringContainingInteger,
|
|
312
318
|
isThePreviousDay,
|
package/package.json
CHANGED
|
@@ -5,6 +5,21 @@ export type Streaks = {
|
|
|
5
5
|
testStreak: number;
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* @name isFinalTest
|
|
10
|
+
* @description A lexeme pair in the LEARNING stage is shown once per flashcard review session
|
|
11
|
+
* across a 10-session cycle starting from the session where it was first marked known
|
|
12
|
+
* (firstKnownSessionDigit). This returns true when the given session count lands on the last
|
|
13
|
+
* session of that cycle, at which point the pair should be promoted to RETIRED.
|
|
14
|
+
*/
|
|
15
|
+
export const isFinalTest = (
|
|
16
|
+
firstKnownSessionDigit: number,
|
|
17
|
+
testsCompletedCount: number
|
|
18
|
+
): boolean => {
|
|
19
|
+
const currentSessionDigit = testsCompletedCount % 10;
|
|
20
|
+
return currentSessionDigit === (firstKnownSessionDigit + 9) % 10;
|
|
21
|
+
}
|
|
22
|
+
|
|
8
23
|
export const deriveStreakFromVocabCheckActivity = (activity: IVocabCheckActivity[], today: DateString): Streaks => {
|
|
9
24
|
if (activity.length === 0) return { flashcardStreak: 0, testStreak: 0 };
|
|
10
25
|
let flashcardStreak = 0;
|
package/src/design/api.ts
CHANGED
|
@@ -47,6 +47,7 @@ export enum ApiPath {
|
|
|
47
47
|
LEXEME_PAIR_FAMILIARITY = '/lexemePair/:czId/:enId/:familiarity',
|
|
48
48
|
LEXEME_PAIR_COUNT = '/lexemePairCount',
|
|
49
49
|
LEXEME_PAIR_RECYCLE = '/lexemePair/recycle/:czId/:enId',
|
|
50
|
+
PROGRESS_HISTORY = '/progressHistory/:endDate/:noOfDays',
|
|
50
51
|
PUSH_TOKEN = '/user/pushToken',
|
|
51
52
|
SIGN_IN = '/signIn',
|
|
52
53
|
SIGN_OUT = '/signOut',
|
|
@@ -167,6 +168,10 @@ export interface SelectVocabCheckActivityParams {
|
|
|
167
168
|
endDate: DateString;
|
|
168
169
|
noOfDays: number;
|
|
169
170
|
}
|
|
171
|
+
export interface SelectProgressHistoryParams {
|
|
172
|
+
endDate: DateString;
|
|
173
|
+
noOfDays: number;
|
|
174
|
+
}
|
|
170
175
|
|
|
171
176
|
|
|
172
177
|
/**
|
package/src/design/types.ts
CHANGED
|
@@ -73,6 +73,17 @@ export interface IVocabCheckActivity {
|
|
|
73
73
|
testQuestionCount: number
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
+
/**
|
|
77
|
+
* A user's lexeme pair counts per LearningStageGroup as recorded on a given day. learningCount
|
|
78
|
+
* includes NEW pairs, matching the LearningStageGroup.LEARNING grouping.
|
|
79
|
+
*/
|
|
80
|
+
export interface IProgressHistoryDay {
|
|
81
|
+
date: DateString;
|
|
82
|
+
queuedCount: number;
|
|
83
|
+
learningCount: number;
|
|
84
|
+
retiredCount: number;
|
|
85
|
+
}
|
|
86
|
+
|
|
76
87
|
export type MySQLDate = `${number}-${number}-${number} ${number}:${number}:${number}`;
|
|
77
88
|
|
|
78
89
|
export type DateString = `${number}-${string}-${string}`;
|
package/test/vocabCheck.test.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { expect } from 'chai';
|
|
2
2
|
import { IVocabCheckActivity } from '../src';
|
|
3
|
-
import { deriveStreakFromVocabCheckActivity } from '../src/concrete/vocabCheck';
|
|
3
|
+
import { deriveStreakFromVocabCheckActivity, isFinalTest } from '../src/concrete/vocabCheck';
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
@@ -47,3 +47,33 @@ describe('deriveStreakFromVocabCheckActivity', () => {
|
|
|
47
47
|
});
|
|
48
48
|
|
|
49
49
|
});
|
|
50
|
+
|
|
51
|
+
describe('isFinalTest', () => {
|
|
52
|
+
it('should return true if the firstKnownSessionDigit is 0 and the rightmost digit of the testsCompletedCount is 9', () => {
|
|
53
|
+
const firstKnownSessionDigit = 0;
|
|
54
|
+
const testsCompletedCount = 9;
|
|
55
|
+
expect(isFinalTest(firstKnownSessionDigit, testsCompletedCount)).to.be.true;
|
|
56
|
+
});
|
|
57
|
+
it('should return true for [1,0], [2,1] etc.', () => {
|
|
58
|
+
expect(isFinalTest(1, 0)).to.be.true;
|
|
59
|
+
expect(isFinalTest(2, 1)).to.be.true;
|
|
60
|
+
expect(isFinalTest(3, 2)).to.be.true;
|
|
61
|
+
expect(isFinalTest(4, 3)).to.be.true;
|
|
62
|
+
expect(isFinalTest(5, 4)).to.be.true;
|
|
63
|
+
expect(isFinalTest(6, 5)).to.be.true;
|
|
64
|
+
expect(isFinalTest(7, 6)).to.be.true;
|
|
65
|
+
expect(isFinalTest(8, 7)).to.be.true;
|
|
66
|
+
expect(isFinalTest(9, 8)).to.be.true;
|
|
67
|
+
})
|
|
68
|
+
it('should return false for invalid params', () => {
|
|
69
|
+
expect(isFinalTest(1, 1)).to.be.false;
|
|
70
|
+
expect(isFinalTest(1, 2)).to.be.false;
|
|
71
|
+
expect(isFinalTest(1, 3)).to.be.false;
|
|
72
|
+
expect(isFinalTest(1, 4)).to.be.false;
|
|
73
|
+
expect(isFinalTest(1, 5)).to.be.false;
|
|
74
|
+
expect(isFinalTest(1, 6)).to.be.false;
|
|
75
|
+
expect(isFinalTest(1, 7)).to.be.false;
|
|
76
|
+
expect(isFinalTest(1, 8)).to.be.false;
|
|
77
|
+
expect(isFinalTest(1, 9)).to.be.false;
|
|
78
|
+
})
|
|
79
|
+
});
|