@studyportals/sp-lurch-interface 2.14.0 → 2.14.2-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.
Files changed (145) hide show
  1. package/{index.ts → index.d.ts} +21 -43
  2. package/index.js +17 -0
  3. package/index.js.map +1 -0
  4. package/package.json +23 -21
  5. package/src/entities/organisation/i-organisation.interface.d.ts +5 -0
  6. package/src/entities/organisation/i-organisation.interface.js +2 -0
  7. package/src/entities/organisation/i-organisation.interface.js.map +1 -0
  8. package/src/entities/organisation/organisation-dto.class.d.ts +7 -0
  9. package/src/entities/organisation/organisation-dto.class.js +8 -0
  10. package/src/entities/organisation/organisation-dto.class.js.map +1 -0
  11. package/src/entities/organisation/organisations-dto.d.ts +6 -0
  12. package/src/entities/organisation/organisations-dto.js +7 -0
  13. package/src/entities/organisation/organisations-dto.js.map +1 -0
  14. package/src/input-batches/input-batch-dto.class.d.ts +15 -0
  15. package/src/input-batches/input-batch-dto.class.js +16 -0
  16. package/src/input-batches/input-batch-dto.class.js.map +1 -0
  17. package/src/input-batches/input-batch-status.d.ts +5 -0
  18. package/src/input-batches/input-batch-status.js +7 -0
  19. package/src/input-batches/input-batch-status.js.map +1 -0
  20. package/src/input-batches/interfaces/i-input-batch.interface.d.ts +13 -0
  21. package/src/input-batches/interfaces/i-input-batch.interface.js +2 -0
  22. package/src/input-batches/interfaces/i-input-batch.interface.js.map +1 -0
  23. package/src/intakes/intake-dto.class.d.ts +14 -0
  24. package/src/intakes/intake-dto.class.js +14 -0
  25. package/src/intakes/intake-dto.class.js.map +1 -0
  26. package/src/intakes/intake-stage-type.d.ts +6 -0
  27. package/src/intakes/intake-stage-type.js +8 -0
  28. package/src/intakes/intake-stage-type.js.map +1 -0
  29. package/src/intakes/interfaces/i-intake.interface.d.ts +12 -0
  30. package/src/intakes/interfaces/i-intake.interface.js +2 -0
  31. package/src/intakes/interfaces/i-intake.interface.js.map +1 -0
  32. package/src/intakes/interfaces/i-match.interface.d.ts +4 -0
  33. package/src/intakes/interfaces/i-match.interface.js +2 -0
  34. package/src/intakes/interfaces/i-match.interface.js.map +1 -0
  35. package/src/intakes/match-dto.class.d.ts +6 -0
  36. package/src/intakes/match-dto.class.js +7 -0
  37. package/src/intakes/match-dto.class.js.map +1 -0
  38. package/src/lurch-client.d.ts +19 -0
  39. package/src/lurch-client.js +73 -0
  40. package/src/lurch-client.js.map +1 -0
  41. package/src/results/discard-input-batch-result.class.d.ts +6 -0
  42. package/src/results/discard-input-batch-result.class.js +13 -0
  43. package/src/results/discard-input-batch-result.class.js.map +1 -0
  44. package/src/results/microsite-student-profile-result.class.d.ts +8 -0
  45. package/src/results/microsite-student-profile-result.class.js +15 -0
  46. package/src/results/microsite-student-profile-result.class.js.map +1 -0
  47. package/src/results/retrieve-input-batch-result.class.d.ts +8 -0
  48. package/src/results/retrieve-input-batch-result.class.js +15 -0
  49. package/src/results/retrieve-input-batch-result.class.js.map +1 -0
  50. package/src/results/retrieve-input-batches-result.class.d.ts +8 -0
  51. package/src/results/retrieve-input-batches-result.class.js +15 -0
  52. package/src/results/retrieve-input-batches-result.class.js.map +1 -0
  53. package/src/results/retrieve-intake-result.class.d.ts +8 -0
  54. package/src/results/retrieve-intake-result.class.js +15 -0
  55. package/src/results/retrieve-intake-result.class.js.map +1 -0
  56. package/src/results/retrieve-intakes-result.class.d.ts +8 -0
  57. package/src/results/retrieve-intakes-result.class.js +15 -0
  58. package/src/results/retrieve-intakes-result.class.js.map +1 -0
  59. package/src/results/retrieve-organisations-result.class.d.ts +9 -0
  60. package/src/results/retrieve-organisations-result.class.js +17 -0
  61. package/src/results/retrieve-organisations-result.class.js.map +1 -0
  62. package/src/results/submit-matches-result.class.d.ts +6 -0
  63. package/src/results/submit-matches-result.class.js +13 -0
  64. package/src/results/submit-matches-result.class.js.map +1 -0
  65. package/src/student-profile/interfaces/I-microsite-student-profile.interface.d.ts +9 -0
  66. package/src/student-profile/interfaces/I-microsite-student-profile.interface.js +2 -0
  67. package/src/student-profile/interfaces/I-microsite-student-profile.interface.js.map +1 -0
  68. package/tests-u/entities/organisations/organisation-dto.test.d.ts +1 -0
  69. package/tests-u/entities/organisations/organisation-dto.test.js +60 -0
  70. package/tests-u/entities/organisations/organisation-dto.test.js.map +1 -0
  71. package/tests-u/input-batches/input-batch-dto.test.d.ts +1 -0
  72. package/tests-u/input-batches/input-batch-dto.test.js +148 -0
  73. package/tests-u/input-batches/input-batch-dto.test.js.map +1 -0
  74. package/tests-u/input-batches/input-batch-status.test.d.ts +1 -0
  75. package/tests-u/input-batches/input-batch-status.test.js +45 -0
  76. package/tests-u/input-batches/input-batch-status.test.js.map +1 -0
  77. package/tests-u/intakes/intake-dto.test.d.ts +1 -0
  78. package/tests-u/intakes/intake-dto.test.js +126 -0
  79. package/tests-u/intakes/intake-dto.test.js.map +1 -0
  80. package/tests-u/intakes/intake-stage-type.test.d.ts +1 -0
  81. package/tests-u/intakes/intake-stage-type.test.js +54 -0
  82. package/tests-u/intakes/intake-stage-type.test.js.map +1 -0
  83. package/tests-u/intakes/match-dto.test.d.ts +1 -0
  84. package/tests-u/intakes/match-dto.test.js +49 -0
  85. package/tests-u/intakes/match-dto.test.js.map +1 -0
  86. package/tests-u/lurch-client.test.d.ts +1 -0
  87. package/tests-u/lurch-client.test.js +303 -0
  88. package/tests-u/lurch-client.test.js.map +1 -0
  89. package/tests-u/results/discard-input-batch-result.test.d.ts +1 -0
  90. package/tests-u/results/discard-input-batch-result.test.js +38 -0
  91. package/tests-u/results/discard-input-batch-result.test.js.map +1 -0
  92. package/tests-u/results/retrieve-input-batch-result.test.d.ts +1 -0
  93. package/tests-u/results/retrieve-input-batch-result.test.js +49 -0
  94. package/tests-u/results/retrieve-input-batch-result.test.js.map +1 -0
  95. package/tests-u/results/retrieve-input-batches-result.test.d.ts +1 -0
  96. package/tests-u/results/retrieve-input-batches-result.test.js +49 -0
  97. package/tests-u/results/retrieve-input-batches-result.test.js.map +1 -0
  98. package/tests-u/results/retrieve-intake-result.test.d.ts +1 -0
  99. package/tests-u/results/retrieve-intake-result.test.js +49 -0
  100. package/tests-u/results/retrieve-intake-result.test.js.map +1 -0
  101. package/tests-u/results/retrieve-intakes-result.test.d.ts +1 -0
  102. package/tests-u/results/retrieve-intakes-result.test.js +49 -0
  103. package/tests-u/results/retrieve-intakes-result.test.js.map +1 -0
  104. package/tests-u/results/retrieve-organisation-result.test.d.ts +1 -0
  105. package/tests-u/results/retrieve-organisation-result.test.js +51 -0
  106. package/tests-u/results/retrieve-organisation-result.test.js.map +1 -0
  107. package/tests-u/results/submit-matches-result.test.d.ts +1 -0
  108. package/tests-u/results/submit-matches-result.test.js +29 -0
  109. package/tests-u/results/submit-matches-result.test.js.map +1 -0
  110. package/src/entities/organisation/i-organisation.interface.ts +0 -5
  111. package/src/entities/organisation/organisation-dto.class.ts +0 -11
  112. package/src/entities/organisation/organisations-dto.ts +0 -9
  113. package/src/input-batches/input-batch-dto.class.ts +0 -19
  114. package/src/input-batches/input-batch-status.ts +0 -5
  115. package/src/input-batches/interfaces/i-input-batch.interface.ts +0 -13
  116. package/src/intakes/intake-dto.class.ts +0 -18
  117. package/src/intakes/intake-stage-type.ts +0 -6
  118. package/src/intakes/interfaces/i-intake.interface.ts +0 -14
  119. package/src/intakes/interfaces/i-match.interface.ts +0 -4
  120. package/src/intakes/match-dto.class.ts +0 -10
  121. package/src/lurch-client.ts +0 -85
  122. package/src/results/discard-input-batch-result.class.ts +0 -21
  123. package/src/results/microsite-student-profile-result.class.ts +0 -25
  124. package/src/results/retrieve-input-batch-result.class.ts +0 -25
  125. package/src/results/retrieve-input-batches-result.class.ts +0 -25
  126. package/src/results/retrieve-intake-result.class.ts +0 -25
  127. package/src/results/retrieve-intakes-result.class.ts +0 -25
  128. package/src/results/retrieve-organisations-result.class.ts +0 -26
  129. package/src/results/submit-matches-result.class.ts +0 -18
  130. package/src/student-profile/interfaces/I-microsite-student-profile.interface.ts +0 -10
  131. package/tests-u/entities/organisations/organisation-dto.test.ts +0 -37
  132. package/tests-u/input-batches/input-batch-dto.test.ts +0 -102
  133. package/tests-u/input-batches/input-batch-status.test.ts +0 -21
  134. package/tests-u/intakes/intake-dto.test.ts +0 -86
  135. package/tests-u/intakes/intake-stage-type.test.ts +0 -26
  136. package/tests-u/intakes/match-dto.test.ts +0 -30
  137. package/tests-u/lurch-client.test.ts +0 -257
  138. package/tests-u/results/discard-input-batch-result.test.ts +0 -22
  139. package/tests-u/results/retrieve-input-batch-result.test.ts +0 -31
  140. package/tests-u/results/retrieve-input-batches-result.test.ts +0 -30
  141. package/tests-u/results/retrieve-intake-result.test.ts +0 -30
  142. package/tests-u/results/retrieve-intakes-result.test.ts +0 -30
  143. package/tests-u/results/retrieve-organisation-result.test.ts +0 -32
  144. package/tests-u/results/submit-matches-result.test.ts +0 -16
  145. package/tsconfig.json +0 -38
@@ -1,102 +0,0 @@
1
- import { assert } from "chai";
2
- import { suite, test } from "mocha-typescript";
3
-
4
- import { InputBatchDto } from "../../src/input-batches/input-batch-dto.class";
5
-
6
-
7
- @suite
8
- class InputBatchDtoTest {
9
- @test
10
- public constructor__TypeGuardSet() {
11
- const testInstance = new InputBatchDto("", "", 0, "", 0, 0, 0, 0, 0, "");
12
-
13
- assert.isTrue(testInstance.__i_input_batch__);
14
- }
15
-
16
- @test
17
- public serialization__TypeGuardSerialized() {
18
- const deserialized = JSON.parse(JSON.stringify(new InputBatchDto("", "", 0, "", 0, 0, 0, 0, 0, "")));
19
-
20
- assert.isTrue(deserialized.__i_input_batch__);
21
- }
22
-
23
- @test
24
- public serialization__IdentitySerialized() {
25
- const value = "SomeValue";
26
- const deserialized = JSON.parse(JSON.stringify(new InputBatchDto(value, "", 0, "", 0, 0, 0, 0, 0, "")));
27
-
28
- assert.equal(deserialized.identity, value);
29
- }
30
-
31
- @test
32
- public serialization__CreationTimeSerialized() {
33
- const value = "SomeValue";
34
- const deserialized = JSON.parse(JSON.stringify(new InputBatchDto("", value, 0, "", 0, 0, 0, 0, 0, "")));
35
-
36
- assert.equal(deserialized.creationTimeIso, value);
37
- }
38
-
39
- @test
40
- public serialization__StatusSerialized() {
41
- const value = 0;
42
- const deserialized = JSON.parse(JSON.stringify(new InputBatchDto("", "", value, "", 0, 0, 0, 0, 0, "")));
43
-
44
- assert.equal(deserialized.status, value);
45
- }
46
-
47
- @test
48
- public serialization__OrganisationIdSerialized() {
49
- const value = "SomeValue";
50
- const deserialized = JSON.parse(JSON.stringify(new InputBatchDto("", "", 0, value, 0, 0, 0, 0, 0, "")));
51
-
52
- assert.equal(deserialized.organisationIdentity, value);
53
- }
54
-
55
- @test
56
- public serialization__IntakeMonthSerialized() {
57
- const value = 1;
58
- const deserialized = JSON.parse(JSON.stringify(new InputBatchDto("", "", 0, "", value, 0, 0, 0, 0, "")));
59
-
60
- assert.equal(deserialized.intakeMonth, value);
61
- }
62
-
63
- @test
64
- public serialization__IntakeYearSerialized() {
65
- const value = 1;
66
- const deserialized = JSON.parse(JSON.stringify(new InputBatchDto("", "", 0, "", 0, value, 0, 0, 0, "")));
67
-
68
- assert.equal(deserialized.intakeYear, value);
69
- }
70
-
71
- @test
72
- public serialization__TargetIntakeStageTypeSerialized() {
73
- const value = "SomeValue" as any;
74
- const deserialized = JSON.parse(JSON.stringify(new InputBatchDto("", "", 0, "", 0, 0, value, 0, 0, "")));
75
-
76
- assert.equal(deserialized.targetIntakeStageType, value);
77
- }
78
-
79
- @test
80
- public serialization__InputSizeSerialized() {
81
- const value = "SomeValue" as any;
82
- const deserialized = JSON.parse(JSON.stringify(new InputBatchDto("", "", 0, "", 0, 0, 0, value, 0, "")));
83
-
84
- assert.equal(deserialized.inputSize, value);
85
- }
86
-
87
- @test
88
- public serialization__MatchesCountSerialized() {
89
- const value = "SomeValue" as any;
90
- const deserialized = JSON.parse(JSON.stringify(new InputBatchDto("", "", 0, "", 0, 0, 0, 0, value, "")));
91
-
92
- assert.equal(deserialized.matchesCount, value);
93
- }
94
-
95
- @test
96
- public serialization__RepresentativeIdentitySerialized() {
97
- const value = "SomeValue" as any;
98
- const deserialized = JSON.parse(JSON.stringify(new InputBatchDto("", "", 0, "", 0, 0, 0, 0, 0, value)));
99
-
100
- assert.equal(deserialized.representativeIdentity, value);
101
- }
102
- }
@@ -1,21 +0,0 @@
1
- import { assert } from 'chai';
2
- import { suite, test } from 'mocha-typescript';
3
- import { InputBatchStatus } from '../..';
4
-
5
- @suite
6
- class InputBatchStatusTest {
7
- @test
8
- public submitted_0() {
9
- assert.equal(InputBatchStatus.SUBMITTED, 0);
10
- }
11
-
12
- @test
13
- public approved_1() {
14
- assert.equal(InputBatchStatus.APPROVED, 1);
15
- }
16
-
17
- @test
18
- public discarded_2() {
19
- assert.equal(InputBatchStatus.DISCARDED, 2);
20
- }
21
- }
@@ -1,86 +0,0 @@
1
- import { assert } from "chai";
2
- import { suite, test } from "mocha-typescript";
3
-
4
- import { IntakeDto } from "../../src/intakes/intake-dto.class";
5
-
6
-
7
- @suite
8
- class IntakeDtoTest {
9
- @test
10
- public constructor__TypeGuardSet() {
11
- const testInstance = new IntakeDto("", "", 0, 0, [], [], [], []);
12
-
13
- assert.isTrue(testInstance.__i_intake__);
14
- }
15
-
16
- @test
17
- public serialization__TypeGuardSerialized() {
18
- const deserialized = JSON.parse(JSON.stringify(new IntakeDto("", "", 0, 0, [], [], [], [])));
19
-
20
- assert.isTrue(deserialized.__i_intake__);
21
- }
22
-
23
- @test
24
- public serialization__IdentitySerialized() {
25
- const value = "SomeValue";
26
- const deserialized = JSON.parse(JSON.stringify(new IntakeDto(value, "", 0, 0, [], [], [], [])));
27
-
28
- assert.equal(deserialized.identity, value);
29
- }
30
-
31
- @test
32
- public serialization__OrganisationIdSerialized() {
33
- const value = "SomeValue";
34
- const deserialized = JSON.parse(JSON.stringify(new IntakeDto("", value, 0, 0, [], [], [], [])));
35
-
36
- assert.equal(deserialized.organisationId, value);
37
- }
38
-
39
- @test
40
- public serialization__IntakeMonthSerialized() {
41
- const value = 1;
42
- const deserialized = JSON.parse(JSON.stringify(new IntakeDto("", "", value, 0, [], [], [], [])));
43
-
44
- assert.equal(deserialized.intakeMonth, value);
45
- }
46
-
47
- @test
48
- public serialization__IntakeYearSerialized() {
49
- const value = 1;
50
- const deserialized = JSON.parse(JSON.stringify(new IntakeDto("", "", 0, value, [], [], [], [])));
51
-
52
- assert.equal(deserialized.intakeYear, value);
53
- }
54
-
55
- @test
56
- public serialization__ApplicationsSerialized() {
57
- const value = "SomeValue" as any;
58
- const deserialized = JSON.parse(JSON.stringify(new IntakeDto("", "", 0, 0, value, [], [], [])));
59
-
60
- assert.equal(deserialized.applications, value);
61
- }
62
-
63
- @test
64
- public serialization__AcceptedSerialized() {
65
- const value = "SomeValue" as any;
66
- const deserialized = JSON.parse(JSON.stringify(new IntakeDto("", "", 0, 0, [], value, [], [])));
67
-
68
- assert.equal(deserialized.accepted, value);
69
- }
70
-
71
- @test
72
- public serialization__EnrolmentsSerialized() {
73
- const value = "SomeValue" as any;
74
- const deserialized = JSON.parse(JSON.stringify(new IntakeDto("", "", 0, 0, [], [], value, [])));
75
-
76
- assert.equal(deserialized.enrolments, value);
77
- }
78
-
79
- @test
80
- public serialization__LeadsSerialized() {
81
- const value = "SomeValue" as any;
82
- const deserialized = JSON.parse(JSON.stringify(new IntakeDto("", "", 0, 0, [], [], [], value)));
83
-
84
- assert.equal(deserialized.leads, value);
85
- }
86
- }
@@ -1,26 +0,0 @@
1
- import { assert } from 'chai';
2
- import { suite, test } from 'mocha-typescript';
3
- import { IntakeStageType } from '../../src/intakes/intake-stage-type';
4
-
5
- @suite
6
- class IntakeStageTypeTest {
7
- @test
8
- public application_0() {
9
- assert.equal(IntakeStageType.APPLICATION, 0);
10
- }
11
-
12
- @test
13
- public accepted_1() {
14
- assert.equal(IntakeStageType.ACCEPTED, 1);
15
- }
16
-
17
- @test
18
- public enrolment_2() {
19
- assert.equal(IntakeStageType.ENROLMENT, 2);
20
- }
21
-
22
- @test
23
- public lead_3() {
24
- assert.equal(IntakeStageType.LEAD, 3);
25
- }
26
- }
@@ -1,30 +0,0 @@
1
- import { assert } from "chai";
2
- import { suite, test } from "mocha-typescript";
3
-
4
- import { MatchDto } from "../../src/intakes/match-dto.class";
5
-
6
-
7
- @suite
8
- class MatchDtoTest {
9
- @test
10
- public constructor__TypeGuardSet() {
11
- const testInstance = new MatchDto("");
12
-
13
- assert.isTrue(testInstance.__i_match__);
14
- }
15
-
16
- @test
17
- public serialization__TypeGuardSerialized() {
18
- const deserialization = JSON.parse(JSON.stringify(new MatchDto("")));
19
-
20
- assert.isTrue(deserialization.__i_match__);
21
- }
22
-
23
- @test
24
- public serialization__StudentIdSerialized() {
25
- const value = "SomeValue";
26
- const deserialization = JSON.parse(JSON.stringify(new MatchDto(value)));
27
-
28
- assert.equal(deserialization.studentId, value);
29
- }
30
- }
@@ -1,257 +0,0 @@
1
- import { assert } from "chai";
2
- import { suite, test } from "mocha-typescript";
3
- import { SuperAgentRequest } from "superagent";
4
- import {
5
- IMock, It,
6
- Mock, Times,
7
- } from "typemoq";
8
-
9
- import { IRequestSender, ISuperAgentRequestFactory } from "@studyportals/mb-platform-http-requests";
10
-
11
- import { LurchClient, RetrieveInputBatchesResult } from "../";
12
- import { OrganisationsDto } from "../src/entities/organisation/organisations-dto";
13
-
14
-
15
- @suite
16
- class LurchClientTest {
17
- private mockedSuperAgentRequestFactory: IMock<ISuperAgentRequestFactory>;
18
- private mockedRequest: IMock<SuperAgentRequest>;
19
- private mockedRequestSender: IMock<IRequestSender>;
20
- private mockedTestInstance: IMock<LurchClient>;
21
-
22
- private get superAgentRequestFactory(): ISuperAgentRequestFactory {
23
- return this.mockedSuperAgentRequestFactory.object;
24
- }
25
- private get request(): SuperAgentRequest {
26
- return this.mockedRequest.object;
27
- }
28
- private get requestSender(): IRequestSender {
29
- return this.mockedRequestSender.object;
30
- }
31
- private get testInstance(): LurchClient {
32
- return this.mockedTestInstance.object;
33
- }
34
-
35
-
36
- public before() {
37
- this.mockedSuperAgentRequestFactory = Mock.ofType<ISuperAgentRequestFactory>();
38
- this.mockedRequest = Mock.ofType<SuperAgentRequest>();
39
- this.mockedRequestSender = Mock.ofType<IRequestSender>();
40
-
41
- const { mockedTestInstance } = this.createTestInstance();
42
- this.mockedTestInstance = mockedTestInstance;
43
-
44
- this.mockedTestInstance.setup(_ => _["createGetRequest"](It.isAny()))
45
- .returns(() => this.request);
46
- this.mockedTestInstance.setup(_ => _["createPostRequest"](It.isAny()))
47
- .returns(() => this.request);
48
- }
49
-
50
-
51
-
52
- @test
53
- public buildUrl__RelativePathConcatenatedToBaseUrl() {
54
- const baseUrl = "SomeBaseUrl";
55
- const relativePath = "SomeRelativePath";
56
- const expectedResult = `${baseUrl}${relativePath}`;
57
-
58
- this.mockedTestInstance.setup(_ => _["baseUrl"]).returns(() => baseUrl);
59
-
60
- const result = this.testInstance["buildUrl"](relativePath);
61
-
62
- assert.equal(result, expectedResult);
63
- }
64
-
65
-
66
-
67
-
68
-
69
- @test
70
- public async retrieveAllInputBatches__GetRequestCreatedForCorrectPath() {
71
- this.mockedRequestSender.setup(_ => _.sendAndExtractBody(It.isAny())).returns(() => ({} as any));
72
-
73
- await this.testInstance.retrieveAllInputBatches();
74
-
75
- this.mockedTestInstance.verify(_ => _["createGetRequest"]("/input-batches"), Times.once());
76
- }
77
-
78
- @test
79
- public async retrieveAllInputBatches__RequestSent() {
80
- this.mockedRequestSender.setup(_ => _.sendAndExtractBody(It.isAny())).returns(() => ({} as any));
81
-
82
- await this.testInstance.retrieveAllInputBatches();
83
-
84
- this.mockedRequestSender.verify(_ => _.sendAndExtractBody(this.request), Times.once());
85
- }
86
-
87
- @test
88
- public async retrieveAllInputBatches__InputBatchesProvided() {
89
- const inputBatches = "SomeInputBatches" as any;
90
- const retrieveInputBatchesResult = new RetrieveInputBatchesResult(inputBatches);
91
-
92
- this.mockedRequestSender.setup(_ => _.sendAndExtractBody(It.isAny())).returns(async () => retrieveInputBatchesResult);
93
-
94
- const result = await this.testInstance.retrieveAllInputBatches();
95
-
96
- assert.equal(result, inputBatches);
97
- }
98
-
99
- @test
100
- public async approveInputBatch__PostRequestCreatedForCorrectPath() {
101
- await this.testInstance.approveInputBatch(It.isAny());
102
-
103
- this.mockedTestInstance.verify(_ => _["createPostRequest"]("/input-batch/approve"), Times.once());
104
- }
105
-
106
- @test
107
- public async approveInputBatch__InputBatchIdentitySpecified() {
108
- const inputBatchIdentity = "InputBatchIdentity" as any;
109
-
110
- await this.testInstance.approveInputBatch(inputBatchIdentity);
111
-
112
- this.mockedRequest.verify(_ => _.send(It.isObjectWith({ inputBatchIdentity: inputBatchIdentity })), Times.once());
113
- }
114
-
115
- @test
116
- public async approveInputBatch__RequestSent() {
117
- let awaited = false;
118
-
119
- this.mockedRequestSender.setup(_ => _.send(It.isAny()))
120
- .returns(() => new Promise(_ => setImmediate(() => { awaited=true; _(); })));;
121
-
122
- await this.testInstance.approveInputBatch(It.isAny());
123
-
124
- this.mockedRequestSender.verify(_ => _.send(this.request), Times.once());
125
- assert.isTrue(awaited);
126
- }
127
-
128
- @test
129
- public async discardInputBatch__PostRequestCreatedForCorrectPath() {
130
- await this.testInstance.discardInputBatch(It.isAny());
131
-
132
- this.mockedTestInstance.verify(_ => _["createPostRequest"]("/input-batch/discard"), Times.once());
133
- }
134
-
135
- @test
136
- public async discardInputBatch__InputBatchIdentitySpecified() {
137
- const inputBatchIdentity = "InputBatchIdentity" as any;
138
-
139
- await this.testInstance.discardInputBatch(inputBatchIdentity);
140
-
141
- this.mockedRequest.verify(_ => _.send(It.isObjectWith({ inputBatchIdentity: inputBatchIdentity })), Times.once());
142
- }
143
-
144
- @test
145
- public async discardInputBatch__RequestSent() {
146
- let awaited = false;
147
-
148
- this.mockedRequestSender.setup(_ => _.send(It.isAny()))
149
- .returns(() => new Promise(_ => setImmediate(() => { awaited = true; _(); })));;
150
-
151
- await this.testInstance.discardInputBatch(It.isAny());
152
-
153
- this.mockedRequestSender.verify(_ => _.send(this.request), Times.once());
154
- assert.isTrue(awaited);
155
- }
156
-
157
- @test
158
- public createGetRequest__UrlCorrectlyBuilt() {
159
- const {mockedTestInstance, testInstance} = this.createTestInstance();
160
-
161
- const relativePath = "SomeRelativePath";
162
- const url = "SomeUrl";
163
-
164
- mockedTestInstance.setup(_ => _["buildUrl"](It.isAny())).returns(() => url);
165
-
166
- testInstance["createGetRequest"](relativePath);
167
-
168
- mockedTestInstance.verify(_ => _["buildUrl"](relativePath), Times.once());
169
- }
170
-
171
- @test
172
- public createGetRequest__GetRequestCreatedAndProvided() {
173
- const {mockedTestInstance, testInstance} = this.createTestInstance();
174
- const url = "SomeUrl";
175
- const request = "SomeRequest" as any;
176
-
177
- this.mockedSuperAgentRequestFactory.setup(_ => _.get(It.isAny())).returns(() => request);
178
- mockedTestInstance.setup(_ => _["buildUrl"](It.isAny())).returns(() => url);
179
-
180
- const result = testInstance["createGetRequest"]("");
181
-
182
- assert.equal(result, request);
183
- this.mockedSuperAgentRequestFactory.verify(_ => _.get(url), Times.once());
184
- }
185
-
186
- @test
187
- public createPostRequest__UrlCorrectlyBuilt() {
188
- const {mockedTestInstance, testInstance} = this.createTestInstance();
189
-
190
- const relativePath = "SomeRelativePath";
191
- const url = "SomeUrl";
192
-
193
- mockedTestInstance.setup(_ => _["buildUrl"](It.isAny())).returns(() => url);
194
-
195
- testInstance["createPostRequest"](relativePath);
196
-
197
- mockedTestInstance.verify(_ => _["buildUrl"](relativePath), Times.once());
198
- }
199
-
200
- @test
201
- public createPostRequest__PostRequestCreatedAndProvided() {
202
- const {mockedTestInstance, testInstance} = this.createTestInstance();
203
- const url = "SomeUrl";
204
- const request = "SomeRequest" as any;
205
-
206
- this.mockedSuperAgentRequestFactory.setup(_ => _.post(It.isAny())).returns(() => request);
207
- mockedTestInstance.setup(_ => _["buildUrl"](It.isAny())).returns(() => url);
208
-
209
- const result = testInstance["createPostRequest"]("");
210
-
211
- assert.equal(result, request);
212
- this.mockedSuperAgentRequestFactory.verify(_ => _.post(url), Times.once());
213
- }
214
-
215
- @test
216
- public async retrieveOrganisationsFromUser__GetRequestCreatedForCorrectPath() {
217
- this.mockedRequestSender.setup(_ => _.sendAndExtractBody(It.isAny())).returns(() => ({} as any));
218
-
219
- await this.testInstance.retrieveOrganisationsFromUser();
220
-
221
- this.mockedTestInstance.verify(_ => _["createGetRequest"]("/organisations-for-user"), Times.once());
222
- }
223
-
224
- @test
225
- public async retrieveOrganisationsFromUser__RequestSent() {
226
- this.mockedRequestSender.setup(_ => _.sendAndExtractBody(It.isAny())).returns(() => ({} as any));
227
-
228
- await this.testInstance.retrieveOrganisationsFromUser();
229
-
230
- this.mockedRequestSender.verify(_ => _.sendAndExtractBody(this.request), Times.once());
231
- }
232
-
233
- @test
234
- public async retrieveOrganisationsFromUser__InputBatchesProvided() {
235
- const userId = "someUserId" as any;
236
- const organisations = "SomeOrganisations" as any;
237
- const organisationDto = new OrganisationsDto(userId, organisations);
238
-
239
- this.mockedRequestSender.setup(_ => _.sendAndExtractBody(It.isAny())).returns(async () => organisationDto);
240
-
241
- const result = await this.testInstance.retrieveOrganisationsFromUser();
242
-
243
- assert.deepEqual(result, organisationDto);
244
- }
245
-
246
-
247
- private createTestInstance() {
248
- const mockedTestInstance = Mock.ofType(LurchClient);
249
- const testInstance = mockedTestInstance.object;
250
-
251
- mockedTestInstance.callBase = true;
252
- mockedTestInstance.setup(_ => _["superAgentRequestFactory"]).returns(() => this.superAgentRequestFactory);
253
- mockedTestInstance.setup(_ => _["requestSender"]).returns(() => this.requestSender);
254
-
255
- return { mockedTestInstance, testInstance };
256
- }
257
- }
@@ -1,22 +0,0 @@
1
- import { assert } from "chai";
2
- import { suite, test } from "mocha-typescript";
3
-
4
- import { DiscardInputBatchresult } from "../..";
5
-
6
-
7
- @suite
8
- class DiscardInputBatchResultTest {
9
- @test
10
- public constructor__TypeGuardInitialized() {
11
- const testInstance = new DiscardInputBatchresult();
12
-
13
- assert.isTrue(testInstance.__discard_input_batch_result__);
14
- }
15
-
16
- @test
17
- public serialization__TypeGuardSerialized() {
18
- const deserialization = JSON.parse(JSON.stringify(new DiscardInputBatchresult()));
19
-
20
- assert.isTrue(deserialization.__discard_input_batch_result__);
21
- }
22
- }
@@ -1,31 +0,0 @@
1
- import { assert } from "chai";
2
- import { suite, test } from "mocha-typescript";
3
-
4
- import { RetrieveInputBatchResult } from "../../src/results/retrieve-input-batch-result.class";
5
- import { RetrieveIntakeResult } from "../../src/results/retrieve-intake-result.class";
6
-
7
-
8
- @suite
9
- class RetrieveInputBatchResultTest {
10
- @test
11
- public constructor__TypeGuardInitialized() {
12
- const testInstance = new RetrieveInputBatchResult(null as any);
13
-
14
- assert.isTrue(testInstance.__retrieve_input_batch_result__);
15
- }
16
-
17
- @test
18
- public serialization__TypeGuardSerialized() {
19
- const deserialization = JSON.parse(JSON.stringify(new RetrieveInputBatchResult(null as any)));
20
-
21
- assert.isTrue(deserialization.__retrieve_input_batch_result__);
22
- }
23
-
24
- @test
25
- public serialization__InputBatchSerialized() {
26
- const value = "SomeValue" as any;
27
- const deserialization = JSON.parse(JSON.stringify(new RetrieveInputBatchResult(value)));
28
-
29
- assert.equal(deserialization.inputBatch, value);
30
- }
31
- }
@@ -1,30 +0,0 @@
1
- import { assert } from "chai";
2
- import { suite, test } from "mocha-typescript";
3
-
4
- import { RetrieveInputBatchesResult } from "../../src/results/retrieve-input-batches-result.class";
5
-
6
-
7
- @suite
8
- class RetrieveInputBatchesResultTest {
9
- @test
10
- public constructor__TypeGuardInitialized() {
11
- const testInstance = new RetrieveInputBatchesResult([]);
12
-
13
- assert.isTrue(testInstance.__retrieve_input_batches_result__);
14
- }
15
-
16
- @test
17
- public serialization__TypeGuardSerialized() {
18
- const deserialization = JSON.parse(JSON.stringify(new RetrieveInputBatchesResult([])));
19
-
20
- assert.isTrue(deserialization.__retrieve_input_batches_result__);
21
- }
22
-
23
- @test
24
- public serialization__InputBatchesSerialized() {
25
- const value = "SomeValue" as any;
26
- const deserialization = JSON.parse(JSON.stringify(new RetrieveInputBatchesResult(value)));
27
-
28
- assert.equal(deserialization.inputBatches, value);
29
- }
30
- }
@@ -1,30 +0,0 @@
1
- import { assert } from "chai";
2
- import { suite, test } from "mocha-typescript";
3
-
4
- import { RetrieveIntakeResult } from "../../src/results/retrieve-intake-result.class";
5
-
6
-
7
- @suite
8
- class RetrieveIntakeResultTest {
9
- @test
10
- public constructor__TypeGuardInitialized() {
11
- const testInstance = new RetrieveIntakeResult(null as any);
12
-
13
- assert.isTrue(testInstance.__retrieve_intake_result__);
14
- }
15
-
16
- @test
17
- public serialization__TypeGuardSerialized() {
18
- const deserialization = JSON.parse(JSON.stringify(new RetrieveIntakeResult(null as any)));
19
-
20
- assert.isTrue(deserialization.__retrieve_intake_result__);
21
- }
22
-
23
- @test
24
- public serialization__IntakeSerialized() {
25
- const value = "SomeValue" as any;
26
- const deserialization = JSON.parse(JSON.stringify(new RetrieveIntakeResult(value)));
27
-
28
- assert.equal(deserialization.intake, value);
29
- }
30
- }
@@ -1,30 +0,0 @@
1
- import { assert } from "chai";
2
- import { suite, test } from "mocha-typescript";
3
-
4
- import { RetrieveIntakesResult } from "../../src/results/retrieve-intakes-result.class";
5
-
6
-
7
- @suite
8
- class RetrieveIntakesResultTest {
9
- @test
10
- public constructor__TypeGuardInitialized() {
11
- const testInstance = new RetrieveIntakesResult([]);
12
-
13
- assert.isTrue(testInstance.__retrieve_intakes_result__);
14
- }
15
-
16
- @test
17
- public serialization__TypeGuardSerialized() {
18
- const deserialization = JSON.parse(JSON.stringify(new RetrieveIntakesResult([])));
19
-
20
- assert.isTrue(deserialization.__retrieve_intakes_result__);
21
- }
22
-
23
- @test
24
- public serialization__IntakesSerialized() {
25
- const value = "SomeValue" as any;
26
- const deserialization = JSON.parse(JSON.stringify(new RetrieveIntakesResult(value)));
27
-
28
- assert.equal(deserialization.intakes, value);
29
- }
30
- }