@everyonesoftware/common 2.0.0 → 4.0.0
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/outputs/chunk-AY3YWKOM.js +7741 -0
- package/outputs/chunk-AY3YWKOM.js.map +1 -0
- package/outputs/sources.cjs +9007 -0
- package/outputs/sources.cjs.map +1 -0
- package/outputs/sources.d.cts +4082 -0
- package/outputs/sources.d.ts +4082 -0
- package/outputs/sources.js +1370 -0
- package/outputs/sources.js.map +1 -0
- package/outputs/tests.cjs +17208 -0
- package/outputs/tests.cjs.map +1 -0
- package/outputs/tests.d.cts +3 -0
- package/outputs/tests.d.ts +3 -0
- package/outputs/tests.js +9798 -0
- package/outputs/tests.js.map +1 -0
- package/package.json +11 -2
- package/.c8rc.json +0 -12
- package/.github/workflows/publish.yml +0 -36
- package/.mocharc.json +0 -9
- package/sources/assertMessageParameters.ts +0 -22
- package/sources/asyncIterator.ts +0 -437
- package/sources/asyncIteratorToJavascriptAsyncIteratorAdapter.ts +0 -48
- package/sources/asyncResult.ts +0 -95
- package/sources/basicDisposable.ts +0 -57
- package/sources/byteList.ts +0 -202
- package/sources/byteListStream.ts +0 -121
- package/sources/byteReadStream.ts +0 -24
- package/sources/byteWriteStream.ts +0 -16
- package/sources/bytes.ts +0 -25
- package/sources/characterList.ts +0 -195
- package/sources/characterListStream.ts +0 -151
- package/sources/characterReadStream.ts +0 -81
- package/sources/characterReadStreamIterator.ts +0 -128
- package/sources/characterWriteStream.ts +0 -45
- package/sources/commandLineParameter.ts +0 -45
- package/sources/commandLineParameters.ts +0 -21
- package/sources/comparable.ts +0 -144
- package/sources/comparer.ts +0 -133
- package/sources/comparison.ts +0 -20
- package/sources/concatenateIterable.ts +0 -119
- package/sources/concatenateIterator.ts +0 -165
- package/sources/condition.ts +0 -329
- package/sources/currentProcess.ts +0 -158
- package/sources/dateTime.ts +0 -130
- package/sources/depthFirstSearch.ts +0 -230
- package/sources/disposable.ts +0 -31
- package/sources/emptyError.ts +0 -10
- package/sources/english.ts +0 -45
- package/sources/equalFunctions.ts +0 -123
- package/sources/fetchHttpClient.ts +0 -89
- package/sources/fetchHttpResponse.ts +0 -106
- package/sources/flatMapIterable.ts +0 -104
- package/sources/flatMapIterator.ts +0 -152
- package/sources/generator.ts +0 -251
- package/sources/httpClient.ts +0 -36
- package/sources/httpHeader.ts +0 -37
- package/sources/httpHeaders.ts +0 -216
- package/sources/httpIncomingRequest.ts +0 -30
- package/sources/httpIncomingResponse.ts +0 -19
- package/sources/httpMethod.ts +0 -164
- package/sources/httpOutgoingRequest.ts +0 -119
- package/sources/httpOutgoingResponse.ts +0 -113
- package/sources/httpServer.ts +0 -34
- package/sources/inMemoryCharacterWriteStream.ts +0 -78
- package/sources/index.ts +0 -101
- package/sources/iterable.ts +0 -345
- package/sources/iterator.ts +0 -481
- package/sources/iteratorToJavascriptIteratorAdapter.ts +0 -48
- package/sources/javascript.ts +0 -59
- package/sources/javascriptArrayList.ts +0 -175
- package/sources/javascriptAsyncIteratorToAsyncIteratorAdapter.ts +0 -124
- package/sources/javascriptIteratorToIteratorAdapter.ts +0 -133
- package/sources/javascriptMapMap.ts +0 -143
- package/sources/javascriptSetSet.ts +0 -134
- package/sources/list.ts +0 -330
- package/sources/listQueue.ts +0 -62
- package/sources/listStack.ts +0 -62
- package/sources/luxonDateTime.ts +0 -109
- package/sources/map.ts +0 -302
- package/sources/mapAsyncIterator.ts +0 -141
- package/sources/mapIterable.ts +0 -105
- package/sources/mapIterator.ts +0 -145
- package/sources/mutableCondition.ts +0 -451
- package/sources/mutableHttpHeaders.ts +0 -204
- package/sources/mutableMap.ts +0 -292
- package/sources/network.ts +0 -18
- package/sources/node.ts +0 -37
- package/sources/nodeJSCharacterWriteStream.ts +0 -42
- package/sources/nodeJSHttpIncomingRequest.ts +0 -132
- package/sources/nodeJSHttpServer.ts +0 -134
- package/sources/notFoundError.ts +0 -12
- package/sources/postCondition.ts +0 -284
- package/sources/postConditionError.ts +0 -12
- package/sources/preCondition.ts +0 -284
- package/sources/preConditionError.ts +0 -12
- package/sources/promiseAsyncResult.ts +0 -174
- package/sources/property.ts +0 -63
- package/sources/queue.ts +0 -49
- package/sources/realNetwork.ts +0 -28
- package/sources/recreationDotGovClient.ts +0 -259
- package/sources/searchControl.ts +0 -42
- package/sources/set.ts +0 -244
- package/sources/skipAsyncIterator.ts +0 -145
- package/sources/skipIterator.ts +0 -155
- package/sources/stack.ts +0 -48
- package/sources/stringComparer.ts +0 -33
- package/sources/stringIterator.ts +0 -149
- package/sources/strings.ts +0 -322
- package/sources/syncResult.ts +0 -300
- package/sources/takeAsyncIterator.ts +0 -141
- package/sources/takeIterator.ts +0 -151
- package/sources/toStringFunctions.ts +0 -185
- package/sources/types.ts +0 -371
- package/sources/whereAsyncIterator.ts +0 -143
- package/sources/whereIterable.ts +0 -108
- package/sources/whereIterator.ts +0 -157
- package/sources/wonderlandTrailClient.ts +0 -1503
- package/tests/assertTest.ts +0 -113
- package/tests/assertTestTests.ts +0 -75
- package/tests/basicTestSkip.ts +0 -51
- package/tests/byteListStreamTests.ts +0 -390
- package/tests/byteListTests.ts +0 -27
- package/tests/bytesTests.ts +0 -43
- package/tests/characterListStreamTests.ts +0 -391
- package/tests/characterListTests.ts +0 -250
- package/tests/characterWriteStreamTests.ts +0 -12
- package/tests/comparerTests.ts +0 -92
- package/tests/conditionTests.ts +0 -877
- package/tests/consoleTestRunner.ts +0 -404
- package/tests/consoleTestRunnerTests.ts +0 -651
- package/tests/dateTimeTests.ts +0 -30
- package/tests/depthFirstSearchTests.ts +0 -106
- package/tests/disposableTests.ts +0 -121
- package/tests/englishTests.ts +0 -103
- package/tests/equalFunctionsTests.ts +0 -223
- package/tests/failedTest.ts +0 -43
- package/tests/fetchHttpClientTests.ts +0 -33
- package/tests/generatorTests.ts +0 -86
- package/tests/httpClientTests.ts +0 -18
- package/tests/inMemoryCharacterWriteStreamTests.ts +0 -117
- package/tests/iterableTests.ts +0 -141
- package/tests/iteratorTests.ts +0 -1086
- package/tests/javascriptMapMapTests.ts +0 -21
- package/tests/listTests.ts +0 -338
- package/tests/mapIteratorTests.ts +0 -55
- package/tests/mapTests.ts +0 -104
- package/tests/mutableConditionTests.ts +0 -273
- package/tests/mutableMapTests.ts +0 -154
- package/tests/nodeJSHttpServerTests.ts +0 -75
- package/tests/notFoundErrorTests.ts +0 -24
- package/tests/postConditionErrorTests.ts +0 -24
- package/tests/preConditionErrorTests.ts +0 -24
- package/tests/promiseAsyncResultTests.ts +0 -688
- package/tests/propertyTests.ts +0 -63
- package/tests/queueTests.ts +0 -29
- package/tests/recreationDotGovClientTests.ts +0 -191
- package/tests/setTests.ts +0 -140
- package/tests/skippedTest.ts +0 -39
- package/tests/stackTests.ts +0 -66
- package/tests/stringComparerTests.ts +0 -60
- package/tests/stringIteratorTests.ts +0 -156
- package/tests/stringsTests.ts +0 -516
- package/tests/syncResultTests.ts +0 -1251
- package/tests/test.ts +0 -228
- package/tests/testAction.ts +0 -75
- package/tests/testActionTests.ts +0 -93
- package/tests/testFailureTests.ts +0 -12
- package/tests/testRunner.ts +0 -267
- package/tests/testRunnerTests.ts +0 -895
- package/tests/testSkip.ts +0 -34
- package/tests/tests.ts +0 -103
- package/tests/toStringFunctionsTests.ts +0 -55
- package/tests/typesTests.ts +0 -257
- package/tests/whereIteratorTests.ts +0 -77
- package/tests/wonderlandTrailClientTests.ts +0 -452
- package/tsconfig.json +0 -20
- package/tsup.config.ts +0 -13
package/tests/propertyTests.ts
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { Property } from "../sources/property";
|
|
2
|
-
import { Test } from "./test";
|
|
3
|
-
import { TestRunner } from "./testRunner";
|
|
4
|
-
|
|
5
|
-
export function test(runner: TestRunner): void
|
|
6
|
-
{
|
|
7
|
-
runner.testFile("property.ts", () =>
|
|
8
|
-
{
|
|
9
|
-
runner.testType("Property<T>", () =>
|
|
10
|
-
{
|
|
11
|
-
runner.testFunction("create()", () =>
|
|
12
|
-
{
|
|
13
|
-
runner.test("with initialValue", (test: Test) =>
|
|
14
|
-
{
|
|
15
|
-
const property: Property<number> = Property.create(5);
|
|
16
|
-
test.assertEqual(5, property.getValue());
|
|
17
|
-
|
|
18
|
-
const setResult: Property<number> = property.setValue(20);
|
|
19
|
-
test.assertSame(property, setResult);
|
|
20
|
-
test.assertEqual(20, property.getValue());
|
|
21
|
-
|
|
22
|
-
test.assertEqual("20", property.toString());
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
runner.test("with getter and setter functions", (test: Test) =>
|
|
26
|
-
{
|
|
27
|
-
let propertyValue: string = "hello";
|
|
28
|
-
|
|
29
|
-
const property: Property<string> = Property.create(
|
|
30
|
-
() => propertyValue,
|
|
31
|
-
(value: string) => { propertyValue = value; },
|
|
32
|
-
);
|
|
33
|
-
test.assertEqual("hello", property.getValue());
|
|
34
|
-
|
|
35
|
-
const setResult: Property<string> = property.setValue("there");
|
|
36
|
-
test.assertSame(property, setResult);
|
|
37
|
-
test.assertEqual("there", property.getValue());
|
|
38
|
-
test.assertEqual("there", propertyValue);
|
|
39
|
-
|
|
40
|
-
test.assertEqual("there", property.toString());
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
runner.test("with options", (test: Test) =>
|
|
44
|
-
{
|
|
45
|
-
let propertyValue: string = "hello";
|
|
46
|
-
|
|
47
|
-
const property: Property<string> = Property.create({
|
|
48
|
-
getter: () => propertyValue,
|
|
49
|
-
setter: (value: string) => { propertyValue = value; },
|
|
50
|
-
});
|
|
51
|
-
test.assertEqual("hello", property.getValue());
|
|
52
|
-
|
|
53
|
-
const setResult: Property<string> = property.setValue("there");
|
|
54
|
-
test.assertSame(property, setResult);
|
|
55
|
-
test.assertEqual("there", property.getValue());
|
|
56
|
-
test.assertEqual("there", propertyValue);
|
|
57
|
-
|
|
58
|
-
test.assertEqual("there", property.toString());
|
|
59
|
-
});
|
|
60
|
-
});
|
|
61
|
-
});
|
|
62
|
-
});
|
|
63
|
-
}
|
package/tests/queueTests.ts
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { EmptyError } from "../sources/emptyError";
|
|
2
|
-
import { ListQueue } from "../sources/listQueue";
|
|
3
|
-
import { Queue } from "../sources/queue";
|
|
4
|
-
import { Test } from "./test";
|
|
5
|
-
import { TestRunner } from "./testRunner";
|
|
6
|
-
|
|
7
|
-
export function test(runner: TestRunner): void
|
|
8
|
-
{
|
|
9
|
-
runner.testFile("queue.ts", () =>
|
|
10
|
-
{
|
|
11
|
-
runner.testType("Queue<T>", () =>
|
|
12
|
-
{
|
|
13
|
-
runner.testFunction("create()", (test: Test) =>
|
|
14
|
-
{
|
|
15
|
-
const queue: ListQueue<number> = Queue.create();
|
|
16
|
-
test.assertNotUndefinedAndNotNull(queue);
|
|
17
|
-
test.assertFalse(queue.any().await());
|
|
18
|
-
test.assertThrows(() => queue.remove().await(), new EmptyError());
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
runner.testFunction("add()", (test: Test) =>
|
|
22
|
-
{
|
|
23
|
-
const queue: ListQueue<number> = Queue.create();
|
|
24
|
-
queue.add(20).await();
|
|
25
|
-
test.assertEqual(20, queue.remove().await());
|
|
26
|
-
});
|
|
27
|
-
});
|
|
28
|
-
});
|
|
29
|
-
}
|
|
@@ -1,191 +0,0 @@
|
|
|
1
|
-
import { HttpClient } from "../sources/httpClient";
|
|
2
|
-
import { PreConditionError } from "../sources/preConditionError";
|
|
3
|
-
import { RecreationDotGovClient, RecreationDotGovDivisionAvailability, RecreationDotGovDivisionAvailabilityJson, RecreationDotGovError, RecreationDotGovPermitItineraryJson } from "../sources/recreationDotGovClient";
|
|
4
|
-
import { WonderlandTrailClient, WonderlandTrailLocations } from "../sources/wonderlandTrailClient";
|
|
5
|
-
import { Test } from "./test";
|
|
6
|
-
import { TestRunner } from "./testRunner";
|
|
7
|
-
import { hasNetworkAccess } from "./tests";
|
|
8
|
-
|
|
9
|
-
export function test(runner: TestRunner): void
|
|
10
|
-
{
|
|
11
|
-
runner.testFile("recreationDotGovClient.ts", () =>
|
|
12
|
-
{
|
|
13
|
-
runner.testType("RecreationDotGovClient", () =>
|
|
14
|
-
{
|
|
15
|
-
runner.testFunction("create()", () =>
|
|
16
|
-
{
|
|
17
|
-
function createErrorTest(httpClient: HttpClient, expected: Error): void
|
|
18
|
-
{
|
|
19
|
-
runner.test(`with ${runner.toString(httpClient)}`, (test: Test) =>
|
|
20
|
-
{
|
|
21
|
-
test.assertThrows(() => RecreationDotGovClient.create(httpClient), expected);
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
createErrorTest(undefined!, new PreConditionError(
|
|
26
|
-
"Expression: httpClient",
|
|
27
|
-
"Expected: not undefined and not null",
|
|
28
|
-
"Actual: undefined",
|
|
29
|
-
));
|
|
30
|
-
createErrorTest(null!, new PreConditionError(
|
|
31
|
-
"Expression: httpClient",
|
|
32
|
-
"Expected: not undefined and not null",
|
|
33
|
-
"Actual: null",
|
|
34
|
-
));
|
|
35
|
-
|
|
36
|
-
runner.test("with default HttpClient", (test: Test) =>
|
|
37
|
-
{
|
|
38
|
-
const httpClient: HttpClient = HttpClient.create();
|
|
39
|
-
const recreationDotGovClient: RecreationDotGovClient = RecreationDotGovClient.create(httpClient);
|
|
40
|
-
test.assertNotUndefinedAndNotNull(recreationDotGovClient);
|
|
41
|
-
});
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
runner.testFunction("getPermitItinerary()", () =>
|
|
45
|
-
{
|
|
46
|
-
function getPermitItineraryErrorTest(itineraryId: string, expected: Error): void
|
|
47
|
-
{
|
|
48
|
-
runner.test(`with ${runner.toString(itineraryId)}`, async (test: Test) =>
|
|
49
|
-
{
|
|
50
|
-
const client: RecreationDotGovClient = RecreationDotGovClient.create(HttpClient.create());
|
|
51
|
-
await test.assertThrowsAsync(async () => await client.getPermitItinerary(itineraryId), expected);
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
getPermitItineraryErrorTest(undefined!, new PreConditionError(
|
|
56
|
-
"Expression: permitItineraryId",
|
|
57
|
-
"Expected: not undefined and not null",
|
|
58
|
-
"Actual: undefined",
|
|
59
|
-
));
|
|
60
|
-
getPermitItineraryErrorTest(null!, new PreConditionError(
|
|
61
|
-
"Expression: permitItineraryId",
|
|
62
|
-
"Expected: not undefined and not null",
|
|
63
|
-
"Actual: null",
|
|
64
|
-
));
|
|
65
|
-
getPermitItineraryErrorTest("", new PreConditionError(
|
|
66
|
-
"Expression: permitItineraryId",
|
|
67
|
-
"Expected: not empty",
|
|
68
|
-
"Actual: \"\"",
|
|
69
|
-
));
|
|
70
|
-
|
|
71
|
-
runner.test("with invalid permit itinerary id", runner.skip(!hasNetworkAccess), async (test: Test) =>
|
|
72
|
-
{
|
|
73
|
-
const client: RecreationDotGovClient = RecreationDotGovClient.create(HttpClient.create());
|
|
74
|
-
await test.assertThrowsAsync(
|
|
75
|
-
async () => await client.getPermitItinerary("oopsie!"),
|
|
76
|
-
new RecreationDotGovError(
|
|
77
|
-
`No permit itinerary found for id: "oopsie!"`,
|
|
78
|
-
),
|
|
79
|
-
);
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
runner.test("with valid permit itinerary id", runner.skip(!hasNetworkAccess), async (test: Test) =>
|
|
83
|
-
{
|
|
84
|
-
const client: RecreationDotGovClient = RecreationDotGovClient.create(HttpClient.create());
|
|
85
|
-
const result: RecreationDotGovPermitItineraryJson = await client.getPermitItinerary(WonderlandTrailClient.permitItineraryId);
|
|
86
|
-
test.assertNotUndefinedAndNotNull(result);
|
|
87
|
-
test.assertEqual(result.id, WonderlandTrailClient.permitItineraryId);
|
|
88
|
-
test.assertEqual(result.name, "Mount Rainier National Park Wilderness and Climbing Permits");
|
|
89
|
-
test.assertNotUndefinedAndNotNull(result.divisions);
|
|
90
|
-
test.assertTrue(Object.keys(result.divisions).length > 0);
|
|
91
|
-
for (const division of Object.values(result.divisions))
|
|
92
|
-
{
|
|
93
|
-
test.assertNotUndefinedAndNotNull(division.id);
|
|
94
|
-
test.assertNotUndefinedAndNotNull(division.district);
|
|
95
|
-
test.assertNotUndefinedAndNotNull(division.name);
|
|
96
|
-
test.assertNotUndefinedAndNotNull(division.type);
|
|
97
|
-
}
|
|
98
|
-
});
|
|
99
|
-
});
|
|
100
|
-
|
|
101
|
-
runner.testFunction("getDivisionAvailability()", () =>
|
|
102
|
-
{
|
|
103
|
-
function getDivisionAvailabilityErrorTest(itineraryId: string, divisionId: string, month: number, year: number, expected: Error): void
|
|
104
|
-
{
|
|
105
|
-
runner.test(`with ${runner.andList([itineraryId, divisionId, month, year])}`, async (test: Test) =>
|
|
106
|
-
{
|
|
107
|
-
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
getDivisionAvailabilityErrorTest(undefined!, "fake-division-id", 5, 2026, new PreConditionError(
|
|
112
|
-
"Expression: permitItineraryId",
|
|
113
|
-
"Expected: not undefined and not null",
|
|
114
|
-
"Actual: undefined",
|
|
115
|
-
));
|
|
116
|
-
getDivisionAvailabilityErrorTest(null!, "fake-division-id", 5, 2026, new PreConditionError(
|
|
117
|
-
"Expression: permitItineraryId",
|
|
118
|
-
"Expected: not undefined and not null",
|
|
119
|
-
"Actual: null",
|
|
120
|
-
));
|
|
121
|
-
getDivisionAvailabilityErrorTest("", "fake-division-id", 5, 2026, new PreConditionError(
|
|
122
|
-
"Expression: permitItineraryId",
|
|
123
|
-
"Expected: not empty",
|
|
124
|
-
"Actual: \"\"",
|
|
125
|
-
));
|
|
126
|
-
getDivisionAvailabilityErrorTest("oopsie!", "fake-division-id", 5, 2026, new RecreationDotGovError(
|
|
127
|
-
`No permit itinerary found for id: "oopsie!"`,
|
|
128
|
-
));
|
|
129
|
-
|
|
130
|
-
runner.test("with invalid division id", runner.skip(!hasNetworkAccess), async (test: Test) =>
|
|
131
|
-
{
|
|
132
|
-
const client: RecreationDotGovClient = RecreationDotGovClient.create(HttpClient.create());
|
|
133
|
-
const itineraryId: string = WonderlandTrailClient.permitItineraryId;
|
|
134
|
-
const divisionId: string = "fake-division-id";
|
|
135
|
-
const month: number = 5;
|
|
136
|
-
const year: number = 2026;
|
|
137
|
-
const earlyAccessPermitLotteryId: string = "";
|
|
138
|
-
|
|
139
|
-
const response: RecreationDotGovDivisionAvailability = await client.getDivisionAvailability(itineraryId, divisionId, month, year, earlyAccessPermitLotteryId);
|
|
140
|
-
|
|
141
|
-
test.assertNotUndefinedAndNotNull(response);
|
|
142
|
-
test.assertNotUndefinedAndNotNull(response.json);
|
|
143
|
-
test.assertNotUndefinedAndNotNull(response.dayAvailabilities);
|
|
144
|
-
test.assertEqual(0, response.dayAvailabilities.getCount().await());
|
|
145
|
-
test.assertUndefined(response.maximumGroupSize);
|
|
146
|
-
test.assertUndefined(response.minimumGroupSize);
|
|
147
|
-
});
|
|
148
|
-
|
|
149
|
-
runner.test("with Sunrise Camp division id", runner.skip(!hasNetworkAccess), async (test: Test) =>
|
|
150
|
-
{
|
|
151
|
-
const client: RecreationDotGovClient = RecreationDotGovClient.create(HttpClient.create());
|
|
152
|
-
|
|
153
|
-
const itineraryId: string = WonderlandTrailClient.permitItineraryId;
|
|
154
|
-
const divisionId: string = WonderlandTrailLocations.sunriseCamp.divisionId;
|
|
155
|
-
const month: number = 8;
|
|
156
|
-
const year: number = 2026;
|
|
157
|
-
const earlyAccessPermitLotteryId: string = "";
|
|
158
|
-
|
|
159
|
-
const response: RecreationDotGovDivisionAvailability = await client.getDivisionAvailability(itineraryId, divisionId, month, year, earlyAccessPermitLotteryId);
|
|
160
|
-
|
|
161
|
-
test.assertNotUndefinedAndNotNull(response);
|
|
162
|
-
test.assertNotUndefinedAndNotNull(response.json);
|
|
163
|
-
test.assertNotUndefinedAndNotNull(response.dayAvailabilities);
|
|
164
|
-
test.assertEqual(31, response.dayAvailabilities.getCount().await());
|
|
165
|
-
test.assertNotUndefinedAndNotNull(response.maximumGroupSize);
|
|
166
|
-
test.assertNotUndefinedAndNotNull(response.minimumGroupSize);
|
|
167
|
-
});
|
|
168
|
-
|
|
169
|
-
runner.test("with Indian Bar division id", runner.skip(!hasNetworkAccess), async (test: Test) =>
|
|
170
|
-
{
|
|
171
|
-
const client: RecreationDotGovClient = RecreationDotGovClient.create(HttpClient.create());
|
|
172
|
-
|
|
173
|
-
const itineraryId: string = WonderlandTrailClient.permitItineraryId;
|
|
174
|
-
const divisionId: string = WonderlandTrailLocations.indianBar.divisionId;
|
|
175
|
-
const month: number = 7;
|
|
176
|
-
const year: number = 2026;
|
|
177
|
-
const earlyAccessPermitLotteryId: string = "";
|
|
178
|
-
|
|
179
|
-
const response: RecreationDotGovDivisionAvailability = await client.getDivisionAvailability(itineraryId, divisionId, month, year, earlyAccessPermitLotteryId);
|
|
180
|
-
|
|
181
|
-
test.assertNotUndefinedAndNotNull(response);
|
|
182
|
-
test.assertNotUndefinedAndNotNull(response.json);
|
|
183
|
-
test.assertNotUndefinedAndNotNull(response.dayAvailabilities);
|
|
184
|
-
test.assertEqual(31, response.dayAvailabilities.getCount().await());
|
|
185
|
-
test.assertNotUndefinedAndNotNull(response.maximumGroupSize);
|
|
186
|
-
test.assertNotUndefinedAndNotNull(response.minimumGroupSize);
|
|
187
|
-
});
|
|
188
|
-
});
|
|
189
|
-
});
|
|
190
|
-
});
|
|
191
|
-
}
|
package/tests/setTests.ts
DELETED
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
import { TestRunner } from "./testRunner";
|
|
2
|
-
import { Set } from "../sources/set";
|
|
3
|
-
import { Test } from "./test";
|
|
4
|
-
import { JavascriptSetSet } from "../sources/javascriptSetSet";
|
|
5
|
-
import { NotFoundError } from "../sources/notFoundError";
|
|
6
|
-
import { SyncResult } from "../sources/syncResult";
|
|
7
|
-
import { JavascriptIterable } from "../sources/javascript";
|
|
8
|
-
import { PreCondition } from "../sources/preCondition";
|
|
9
|
-
import { PreConditionError } from "../sources/preConditionError";
|
|
10
|
-
|
|
11
|
-
export function test(runner: TestRunner): void
|
|
12
|
-
{
|
|
13
|
-
runner.testFile("set.ts", () =>
|
|
14
|
-
{
|
|
15
|
-
runner.testType("Set<T>", () =>
|
|
16
|
-
{
|
|
17
|
-
runner.testFunction("create()", (test: Test) =>
|
|
18
|
-
{
|
|
19
|
-
const set: JavascriptSetSet<number> = Set.create();
|
|
20
|
-
test.assertNotUndefinedAndNotNull(set);
|
|
21
|
-
test.assertEqual(0, set.getCount().await());
|
|
22
|
-
test.assertEqual([], set.toArray().await());
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
runner.testFunction("add()", (test: Test) =>
|
|
26
|
-
{
|
|
27
|
-
const set: Set<number> = Set.create();
|
|
28
|
-
for (let i = 0; i < 3; i++)
|
|
29
|
-
{
|
|
30
|
-
const addResult: Set<number> = set.add(20);
|
|
31
|
-
test.assertSame(set, addResult);
|
|
32
|
-
test.assertTrue(set.contains(20).await());
|
|
33
|
-
test.assertEqual(set.getCount().await(), 1);
|
|
34
|
-
test.assertEqual([20], set.toArray().await());
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
runner.testFunction("addAll()", (test: Test) =>
|
|
39
|
-
{
|
|
40
|
-
const set: Set<number> = Set.create();
|
|
41
|
-
for (let i = 0; i < 3; i++)
|
|
42
|
-
{
|
|
43
|
-
const addResult: Set<number> = set.addAll([20, 20, 25, 26]);
|
|
44
|
-
test.assertSame(set, addResult);
|
|
45
|
-
test.assertTrue(set.contains(20).await());
|
|
46
|
-
test.assertTrue(set.contains(25).await());
|
|
47
|
-
test.assertTrue(set.contains(26).await());
|
|
48
|
-
test.assertEqual(set.getCount().await(), 3);
|
|
49
|
-
test.assertEqual([20, 25, 26], set.toArray().await());
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
runner.testFunction("remove()", (test: Test) =>
|
|
54
|
-
{
|
|
55
|
-
const set: Set<number> = Set.create();
|
|
56
|
-
|
|
57
|
-
test.assertThrows(set.remove(15), new NotFoundError("Could not find 15."));
|
|
58
|
-
|
|
59
|
-
set.add(16);
|
|
60
|
-
const removeResult: SyncResult<void> = set.remove(16);
|
|
61
|
-
test.assertNotUndefinedAndNotNull(removeResult);
|
|
62
|
-
test.assertFalse(set.contains(16).await());
|
|
63
|
-
test.assertUndefined(removeResult.await());
|
|
64
|
-
|
|
65
|
-
test.assertThrows(set.remove(16), new NotFoundError("Could not find 16."));
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
runner.testFunction("toString()", () =>
|
|
69
|
-
{
|
|
70
|
-
function toStringTest<T>(set: Set<T>, expected: string): void
|
|
71
|
-
{
|
|
72
|
-
runner.test(`with ${runner.toString(set)}`, (test: Test) =>
|
|
73
|
-
{
|
|
74
|
-
test.assertEqual(set.toString(), expected);
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
toStringTest(Set.create(), "{}");
|
|
79
|
-
toStringTest(Set.create().addAll([1]), "{1}");
|
|
80
|
-
toStringTest(Set.create().addAll([1, 2]), "{1,2}");
|
|
81
|
-
toStringTest(Set.create().addAll([3, 1, 2]), "{3,1,2}");
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
runner.testFunction("equals()", () =>
|
|
85
|
-
{
|
|
86
|
-
function equalsTest<T>(set: Set<T>, right: JavascriptIterable<T>, expected: boolean): void
|
|
87
|
-
{
|
|
88
|
-
runner.test(`with ${runner.andList([set, right])}`, (test: Test) =>
|
|
89
|
-
{
|
|
90
|
-
test.assertEqual(set.equals(right).await(), expected);
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
equalsTest(Set.create(), [], true);
|
|
95
|
-
equalsTest(Set.create(), [1], false);
|
|
96
|
-
equalsTest(Set.create<number>().addAll([1]), [], false);
|
|
97
|
-
equalsTest(Set.create<number>().addAll([1]), [1], true);
|
|
98
|
-
equalsTest(Set.create<number>().addAll([1]), [1, 1], false);
|
|
99
|
-
equalsTest(Set.create<number>().addAll([1, 2]), [1, 2], true);
|
|
100
|
-
equalsTest(Set.create<number>().addAll([1, 2]), [2, 1], false);
|
|
101
|
-
equalsTest(Set.create<number>().addAll([1, 2]), Set.create<number>().addAll([2, 1]), true);
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
runner.testFunction("union()", () =>
|
|
105
|
-
{
|
|
106
|
-
function unionErrorTest<T>(set: Set<T>, values: JavascriptIterable<T>, expected: Error): void
|
|
107
|
-
{
|
|
108
|
-
runner.test(`with ${runner.andList([set, values])}`, (test: Test) =>
|
|
109
|
-
{
|
|
110
|
-
test.assertThrows(() => set.union(values), expected);
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
unionErrorTest(Set.create<number>(), undefined!, new PreConditionError(
|
|
115
|
-
"Expression: values",
|
|
116
|
-
"Expected: not undefined and not null",
|
|
117
|
-
"Actual: undefined",
|
|
118
|
-
));
|
|
119
|
-
unionErrorTest(Set.create<number>(), null!, new PreConditionError(
|
|
120
|
-
"Expression: values",
|
|
121
|
-
"Expected: not undefined and not null",
|
|
122
|
-
"Actual: null",
|
|
123
|
-
));
|
|
124
|
-
|
|
125
|
-
function unionTest<T>(set: Set<T>, values: JavascriptIterable<T>, expected: JavascriptIterable<T>): void
|
|
126
|
-
{
|
|
127
|
-
runner.test(`with ${runner.andList([set, values])}`, (test: Test) =>
|
|
128
|
-
{
|
|
129
|
-
test.assertEqual(set.union(values).toArray().await(), expected);
|
|
130
|
-
});
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
unionTest(Set.create(), [], []);
|
|
134
|
-
unionTest(Set.create(), [1, 2], [1, 2]);
|
|
135
|
-
unionTest(Set.create([1]), [2], [1, 2]);
|
|
136
|
-
unionTest(Set.create([1, 2]), [1], [1, 2]);
|
|
137
|
-
});
|
|
138
|
-
});
|
|
139
|
-
});
|
|
140
|
-
}
|
package/tests/skippedTest.ts
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { JavascriptIterable } from "../sources/javascript";
|
|
2
|
-
import { PreCondition } from "../sources/preCondition";
|
|
3
|
-
import { join } from "../sources/strings";
|
|
4
|
-
import { TestSkip } from "./testSkip";
|
|
5
|
-
|
|
6
|
-
export class SkippedTest
|
|
7
|
-
{
|
|
8
|
-
private readonly skip: TestSkip;
|
|
9
|
-
private readonly fullTestNameParts: JavascriptIterable<string>;
|
|
10
|
-
|
|
11
|
-
private constructor(skip: TestSkip, fullTestNameParts: JavascriptIterable<string>)
|
|
12
|
-
{
|
|
13
|
-
PreCondition.assertNotUndefinedAndNotNull(skip, "skip");
|
|
14
|
-
PreCondition.assertNotEmpty(fullTestNameParts, "fullTestNameParts");
|
|
15
|
-
|
|
16
|
-
this.skip = skip;
|
|
17
|
-
this.fullTestNameParts = fullTestNameParts;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
public static create(skip: TestSkip, fullTestNameParts: JavascriptIterable<string>): SkippedTest
|
|
21
|
-
{
|
|
22
|
-
return new SkippedTest(skip, fullTestNameParts);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
public getSkipMessage(): string
|
|
26
|
-
{
|
|
27
|
-
return this.skip.getMessage();
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
public getFullTestNameParts(): JavascriptIterable<string>
|
|
31
|
-
{
|
|
32
|
-
return this.fullTestNameParts;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
public getFullTestName(): string
|
|
36
|
-
{
|
|
37
|
-
return join(" ", this.fullTestNameParts);
|
|
38
|
-
}
|
|
39
|
-
}
|
package/tests/stackTests.ts
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { EmptyError } from "../sources/emptyError";
|
|
2
|
-
import { ListStack } from "../sources/listStack";
|
|
3
|
-
import { Stack } from "../sources/stack";
|
|
4
|
-
import { Test } from "./test";
|
|
5
|
-
import { TestRunner } from "./testRunner";
|
|
6
|
-
|
|
7
|
-
export function test(runner: TestRunner): void
|
|
8
|
-
{
|
|
9
|
-
runner.testFile("stack.ts", () =>
|
|
10
|
-
{
|
|
11
|
-
runner.testType("Stack<T>", () =>
|
|
12
|
-
{
|
|
13
|
-
runner.testFunction("create()", (test: Test) =>
|
|
14
|
-
{
|
|
15
|
-
const stack: ListStack<number> = Stack.create();
|
|
16
|
-
test.assertNotUndefinedAndNotNull(stack);
|
|
17
|
-
test.assertFalse(stack.any().await());
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
runner.testFunction("add()", (test: Test) =>
|
|
21
|
-
{
|
|
22
|
-
const stack: ListStack<number> = Stack.create();
|
|
23
|
-
|
|
24
|
-
stack.add(10).await();
|
|
25
|
-
test.assertTrue(stack.any().await());
|
|
26
|
-
|
|
27
|
-
stack.add(20).await();
|
|
28
|
-
test.assertTrue(stack.any().await());
|
|
29
|
-
|
|
30
|
-
test.assertEqual(20, stack.remove().await());
|
|
31
|
-
test.assertEqual(10, stack.remove().await());
|
|
32
|
-
test.assertFalse(stack.any().await());
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
runner.testFunction("addAll()", () =>
|
|
36
|
-
{
|
|
37
|
-
function addAllTest(values: number[]): void
|
|
38
|
-
{
|
|
39
|
-
runner.test(`with ${runner.toString(values)}`, (test: Test) =>
|
|
40
|
-
{
|
|
41
|
-
const stack: ListStack<number> = Stack.create();
|
|
42
|
-
stack.addAll(values).await();
|
|
43
|
-
|
|
44
|
-
for (const value of values.reverse())
|
|
45
|
-
{
|
|
46
|
-
test.assertTrue(stack.any().await());
|
|
47
|
-
test.assertEqual(value, stack.remove().await());
|
|
48
|
-
}
|
|
49
|
-
test.assertFalse(stack.any().await());
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
addAllTest([]);
|
|
54
|
-
addAllTest([1]);
|
|
55
|
-
addAllTest([1, 2]);
|
|
56
|
-
addAllTest([1, 2, 3]);
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
runner.testFunction("remove()", (test: Test) =>
|
|
60
|
-
{
|
|
61
|
-
const stack: ListStack<number> = Stack.create();
|
|
62
|
-
test.assertThrows(() => stack.remove().await(), new EmptyError());
|
|
63
|
-
});
|
|
64
|
-
});
|
|
65
|
-
});
|
|
66
|
-
}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { Comparison } from "../sources/comparison";
|
|
2
|
-
import { StringComparer } from "../sources/stringComparer";
|
|
3
|
-
import { Test } from "./test";
|
|
4
|
-
import { TestRunner } from "./testRunner";
|
|
5
|
-
|
|
6
|
-
export function test(runner: TestRunner): void
|
|
7
|
-
{
|
|
8
|
-
runner.testFile("stringComparer.ts", () =>
|
|
9
|
-
{
|
|
10
|
-
runner.testType("StringComparer", () =>
|
|
11
|
-
{
|
|
12
|
-
runner.testFunction("compare(string, string)", () =>
|
|
13
|
-
{
|
|
14
|
-
function compareTest(left: string, right: string, expected: Comparison): void
|
|
15
|
-
{
|
|
16
|
-
runner.test(`with ${runner.andList([left, right])}`, (test: Test) =>
|
|
17
|
-
{
|
|
18
|
-
const comparer: StringComparer = StringComparer.create();
|
|
19
|
-
test.assertEqual(comparer.compare(left, right), expected);
|
|
20
|
-
test.assertEqual(comparer.lessThan(left, right), expected === Comparison.LessThan);
|
|
21
|
-
test.assertEqual(comparer.lessThanOrEqual(left, right), expected !== Comparison.GreaterThan);
|
|
22
|
-
test.assertEqual(comparer.equal(left, right), expected === Comparison.Equal);
|
|
23
|
-
test.assertEqual(comparer.greaterThanOrEqualTo(left, right), expected !== Comparison.LessThan);
|
|
24
|
-
test.assertEqual(comparer.greaterThan(left, right), expected === Comparison.GreaterThan);
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
compareTest(undefined!, undefined!, Comparison.Equal);
|
|
29
|
-
compareTest(undefined!, null!, Comparison.LessThan);
|
|
30
|
-
compareTest(undefined!, "", Comparison.LessThan);
|
|
31
|
-
compareTest(undefined!, "a", Comparison.LessThan);
|
|
32
|
-
compareTest(undefined!, "def", Comparison.LessThan);
|
|
33
|
-
|
|
34
|
-
compareTest(null!, undefined!, Comparison.GreaterThan);
|
|
35
|
-
compareTest(null!, null!, Comparison.Equal);
|
|
36
|
-
compareTest(null!, "", Comparison.LessThan);
|
|
37
|
-
compareTest(null!, "a", Comparison.LessThan);
|
|
38
|
-
compareTest(null!, "def", Comparison.LessThan);
|
|
39
|
-
|
|
40
|
-
compareTest("", undefined!, Comparison.GreaterThan);
|
|
41
|
-
compareTest("", null!, Comparison.GreaterThan);
|
|
42
|
-
compareTest("", "", Comparison.Equal);
|
|
43
|
-
compareTest("", "a", Comparison.LessThan);
|
|
44
|
-
compareTest("", "def", Comparison.LessThan);
|
|
45
|
-
|
|
46
|
-
compareTest("a", undefined!, Comparison.GreaterThan);
|
|
47
|
-
compareTest("a", null!, Comparison.GreaterThan);
|
|
48
|
-
compareTest("a", "", Comparison.GreaterThan);
|
|
49
|
-
compareTest("a", "a", Comparison.Equal);
|
|
50
|
-
compareTest("a", "def", Comparison.LessThan);
|
|
51
|
-
|
|
52
|
-
compareTest("def", undefined!, Comparison.GreaterThan);
|
|
53
|
-
compareTest("def", null!, Comparison.GreaterThan);
|
|
54
|
-
compareTest("def", "", Comparison.GreaterThan);
|
|
55
|
-
compareTest("def", "a", Comparison.GreaterThan);
|
|
56
|
-
compareTest("def", "def", Comparison.Equal);
|
|
57
|
-
});
|
|
58
|
-
});
|
|
59
|
-
});
|
|
60
|
-
}
|