@event-driven-io/emmett 0.23.0-alpha.3 → 0.23.0-alpha.4

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.cjs CHANGED
@@ -976,7 +976,7 @@ var assertThrowsAsync = async (fun, errorCheck) => {
976
976
  }
977
977
  assertTrue(
978
978
  errorCheck(typedError),
979
- `Error doesn't match the expected condition: ${JSON.stringify(error2)}`
979
+ `Error doesn't match the expected condition: ${JSONParser.stringify(error2)}`
980
980
  );
981
981
  return typedError;
982
982
  }
@@ -990,7 +990,7 @@ var assertThrows = (fun, errorCheck) => {
990
990
  if (errorCheck) {
991
991
  assertTrue(
992
992
  errorCheck(typedError),
993
- `Error doesn't match the expected condition: ${JSON.stringify(error2)}`
993
+ `Error doesn't match the expected condition: ${JSONParser.stringify(error2)}`
994
994
  );
995
995
  } else if (typedError instanceof AssertionError) {
996
996
  assertFalse(
@@ -1002,6 +1002,23 @@ var assertThrows = (fun, errorCheck) => {
1002
1002
  }
1003
1003
  throw new AssertionError("Function didn't throw expected error");
1004
1004
  };
1005
+ var assertDoesNotThrow = (fun, errorCheck) => {
1006
+ try {
1007
+ fun();
1008
+ return null;
1009
+ } catch (error2) {
1010
+ const typedError = error2;
1011
+ if (errorCheck) {
1012
+ assertFalse(
1013
+ errorCheck(typedError),
1014
+ `Error matching the expected condition was thrown!: ${JSONParser.stringify(error2)}`
1015
+ );
1016
+ } else {
1017
+ assertFails(`Function threw an error: ${JSONParser.stringify(error2)}`);
1018
+ }
1019
+ return typedError;
1020
+ }
1021
+ };
1005
1022
  var assertRejects = async (promise, errorCheck) => {
1006
1023
  try {
1007
1024
  await promise;
@@ -1060,7 +1077,7 @@ function assertEqual(expected, actual, message) {
1060
1077
  throw new AssertionError(
1061
1078
  `${_nullishCoalesce(message, () => ( "Objects are not equal"))}:
1062
1079
  Expected: ${JSONParser.stringify(expected)}
1063
- Actual:${JSONParser.stringify(actual)}`
1080
+ Actual: ${JSONParser.stringify(actual)}`
1064
1081
  );
1065
1082
  }
1066
1083
  function assertNotEqual(obj, other, message) {
@@ -1122,8 +1139,12 @@ function verifyThat(fn) {
1122
1139
  }
1123
1140
  var assertThatArray = (array) => {
1124
1141
  return {
1125
- isEmpty: () => assertEqual(array.length, 0),
1126
- isNotEmpty: () => assertNotEqual(array.length, 0),
1142
+ isEmpty: () => assertEqual(
1143
+ array.length,
1144
+ 0,
1145
+ `Array is not empty ${JSONParser.stringify(array)}`
1146
+ ),
1147
+ isNotEmpty: () => assertNotEqual(array.length, 0, `Array is empty`),
1127
1148
  hasSize: (length) => assertEqual(array.length, length),
1128
1149
  containsElements: (other) => {
1129
1150
  assertTrue(other.every((ts) => array.some((o) => deepEquals(ts, o))));
@@ -1132,7 +1153,7 @@ var assertThatArray = (array) => {
1132
1153
  assertTrue(other.every((ts) => array.some((o) => isSubset(o, ts))));
1133
1154
  },
1134
1155
  containsOnlyElementsMatching: (other) => {
1135
- assertEqual(array.length, other.length);
1156
+ assertEqual(array.length, other.length, `Arrays lengths don't match`);
1136
1157
  assertTrue(other.every((ts) => array.some((o) => isSubset(o, ts))));
1137
1158
  },
1138
1159
  containsExactlyInAnyOrder: (other) => {
@@ -1198,7 +1219,14 @@ var DeciderSpecification = {
1198
1219
  const resultEvents = handle();
1199
1220
  const resultEventsArray = Array.isArray(resultEvents) ? resultEvents : [resultEvents];
1200
1221
  const expectedEventsArray = Array.isArray(expectedEvents) ? expectedEvents : [expectedEvents];
1201
- assertMatches(resultEventsArray, expectedEventsArray);
1222
+ assertThatArray(resultEventsArray).containsOnlyElementsMatching(
1223
+ expectedEventsArray
1224
+ );
1225
+ },
1226
+ thenDoesNothing: () => {
1227
+ const resultEvents = handle();
1228
+ const resultEventsArray = Array.isArray(resultEvents) ? resultEvents : [resultEvents];
1229
+ assertThatArray(resultEventsArray).isEmpty();
1202
1230
  },
1203
1231
  thenThrows: (...args) => {
1204
1232
  try {
@@ -1370,5 +1398,6 @@ var WrapEventStore = (eventStore) => {
1370
1398
 
1371
1399
 
1372
1400
 
1373
- exports.AssertionError = AssertionError; exports.BinaryJsonDecoder = BinaryJsonDecoder; exports.CaughtUpTransformStream = CaughtUpTransformStream; exports.CommandHandler = CommandHandler; exports.CommandHandlerStreamVersionConflictRetryOptions = CommandHandlerStreamVersionConflictRetryOptions; exports.CompositeDecoder = CompositeDecoder; exports.ConcurrencyError = _chunkFNITWKARcjs.ConcurrencyError; exports.DeciderCommandHandler = DeciderCommandHandler; exports.DeciderSpecification = DeciderSpecification; exports.DefaultDecoder = DefaultDecoder; exports.EmmettError = _chunkFNITWKARcjs.EmmettError; exports.ExpectedVersionConflictError = ExpectedVersionConflictError; exports.GlobalStreamCaughtUpType = GlobalStreamCaughtUpType; exports.IllegalStateError = _chunkFNITWKARcjs.IllegalStateError; exports.InMemoryEventStoreDefaultStreamVersion = InMemoryEventStoreDefaultStreamVersion; exports.JSONParser = JSONParser; exports.JsonDecoder = JsonDecoder; exports.NO_CONCURRENCY_CHECK = NO_CONCURRENCY_CHECK; exports.NoRetries = NoRetries; exports.NotFoundError = _chunkFNITWKARcjs.NotFoundError; exports.ObjectDecoder = ObjectDecoder; exports.ParseError = ParseError; exports.STREAM_DOES_NOT_EXIST = STREAM_DOES_NOT_EXIST; exports.STREAM_EXISTS = STREAM_EXISTS; exports.StreamingCoordinator = StreamingCoordinator; exports.StringDecoder = StringDecoder; exports.ValidationError = _chunkFNITWKARcjs.ValidationError; exports.ValidationErrors = _chunkFNITWKARcjs.ValidationErrors; exports.WrapEventStore = WrapEventStore; exports.accept = accept; exports.argMatches = argMatches; exports.argValue = argValue; exports.assertDeepEqual = assertDeepEqual; exports.assertEqual = assertEqual; exports.assertExpectedVersionMatchesCurrent = assertExpectedVersionMatchesCurrent; exports.assertFails = assertFails; exports.assertFalse = assertFalse; exports.assertIsNotNull = assertIsNotNull; exports.assertIsNull = assertIsNull; exports.assertMatches = assertMatches; exports.assertNotDeepEqual = assertNotDeepEqual; exports.assertNotEmptyString = _chunkFNITWKARcjs.assertNotEmptyString; exports.assertNotEqual = assertNotEqual; exports.assertOk = assertOk; exports.assertPositiveNumber = _chunkFNITWKARcjs.assertPositiveNumber; exports.assertRejects = assertRejects; exports.assertThat = assertThat; exports.assertThatArray = assertThatArray; exports.assertThrows = assertThrows; exports.assertThrowsAsync = assertThrowsAsync; exports.assertTrue = assertTrue; exports.assertUnsignedBigInt = _chunkFNITWKARcjs.assertUnsignedBigInt; exports.asyncProjections = asyncProjections; exports.asyncRetry = asyncRetry; exports.canCreateEventStoreSession = canCreateEventStoreSession; exports.caughtUpEventFrom = caughtUpEventFrom; exports.collect = collect; exports.command = command; exports.complete = complete; exports.concatUint8Arrays = concatUint8Arrays; exports.deepEquals = deepEquals; exports.error = error; exports.event = event; exports.formatDateToUtcYYYYMMDD = _chunkFNITWKARcjs.formatDateToUtcYYYYMMDD; exports.getInMemoryEventStore = getInMemoryEventStore; exports.getInMemoryMessageBus = getInMemoryMessageBus; exports.globalStreamCaughtUp = globalStreamCaughtUp; exports.ignore = ignore; exports.inlineProjections = inlineProjections; exports.isEquatable = isEquatable; exports.isErrorConstructor = _chunkFNITWKARcjs.isErrorConstructor; exports.isExpectedVersionConflictError = isExpectedVersionConflictError; exports.isGlobalStreamCaughtUp = isGlobalStreamCaughtUp; exports.isNotInternalEvent = isNotInternalEvent; exports.isNumber = _chunkFNITWKARcjs.isNumber; exports.isPluginConfig = _chunkFNITWKARcjs.isPluginConfig; exports.isString = _chunkFNITWKARcjs.isString; exports.isSubscriptionEvent = isSubscriptionEvent; exports.isSubset = isSubset; exports.isValidYYYYMMDD = _chunkFNITWKARcjs.isValidYYYYMMDD; exports.matchesExpectedVersion = matchesExpectedVersion; exports.merge = merge; exports.nulloSessionFactory = nulloSessionFactory; exports.parseDateFromUtcYYYYMMDD = _chunkFNITWKARcjs.parseDateFromUtcYYYYMMDD; exports.projection = projection; exports.projections = projections; exports.publish = publish; exports.reply = reply; exports.restream = restream; exports.schedule = schedule; exports.send = send; exports.streamGenerators = streamGenerators; exports.streamTrackingGlobalPosition = streamTrackingGlobalPosition; exports.streamTransformations = streamTransformations; exports.sum = sum; exports.verifyThat = verifyThat;
1401
+
1402
+ exports.AssertionError = AssertionError; exports.BinaryJsonDecoder = BinaryJsonDecoder; exports.CaughtUpTransformStream = CaughtUpTransformStream; exports.CommandHandler = CommandHandler; exports.CommandHandlerStreamVersionConflictRetryOptions = CommandHandlerStreamVersionConflictRetryOptions; exports.CompositeDecoder = CompositeDecoder; exports.ConcurrencyError = _chunkFNITWKARcjs.ConcurrencyError; exports.DeciderCommandHandler = DeciderCommandHandler; exports.DeciderSpecification = DeciderSpecification; exports.DefaultDecoder = DefaultDecoder; exports.EmmettError = _chunkFNITWKARcjs.EmmettError; exports.ExpectedVersionConflictError = ExpectedVersionConflictError; exports.GlobalStreamCaughtUpType = GlobalStreamCaughtUpType; exports.IllegalStateError = _chunkFNITWKARcjs.IllegalStateError; exports.InMemoryEventStoreDefaultStreamVersion = InMemoryEventStoreDefaultStreamVersion; exports.JSONParser = JSONParser; exports.JsonDecoder = JsonDecoder; exports.NO_CONCURRENCY_CHECK = NO_CONCURRENCY_CHECK; exports.NoRetries = NoRetries; exports.NotFoundError = _chunkFNITWKARcjs.NotFoundError; exports.ObjectDecoder = ObjectDecoder; exports.ParseError = ParseError; exports.STREAM_DOES_NOT_EXIST = STREAM_DOES_NOT_EXIST; exports.STREAM_EXISTS = STREAM_EXISTS; exports.StreamingCoordinator = StreamingCoordinator; exports.StringDecoder = StringDecoder; exports.ValidationError = _chunkFNITWKARcjs.ValidationError; exports.ValidationErrors = _chunkFNITWKARcjs.ValidationErrors; exports.WrapEventStore = WrapEventStore; exports.accept = accept; exports.argMatches = argMatches; exports.argValue = argValue; exports.assertDeepEqual = assertDeepEqual; exports.assertDoesNotThrow = assertDoesNotThrow; exports.assertEqual = assertEqual; exports.assertExpectedVersionMatchesCurrent = assertExpectedVersionMatchesCurrent; exports.assertFails = assertFails; exports.assertFalse = assertFalse; exports.assertIsNotNull = assertIsNotNull; exports.assertIsNull = assertIsNull; exports.assertMatches = assertMatches; exports.assertNotDeepEqual = assertNotDeepEqual; exports.assertNotEmptyString = _chunkFNITWKARcjs.assertNotEmptyString; exports.assertNotEqual = assertNotEqual; exports.assertOk = assertOk; exports.assertPositiveNumber = _chunkFNITWKARcjs.assertPositiveNumber; exports.assertRejects = assertRejects; exports.assertThat = assertThat; exports.assertThatArray = assertThatArray; exports.assertThrows = assertThrows; exports.assertThrowsAsync = assertThrowsAsync; exports.assertTrue = assertTrue; exports.assertUnsignedBigInt = _chunkFNITWKARcjs.assertUnsignedBigInt; exports.asyncProjections = asyncProjections; exports.asyncRetry = asyncRetry; exports.canCreateEventStoreSession = canCreateEventStoreSession; exports.caughtUpEventFrom = caughtUpEventFrom; exports.collect = collect; exports.command = command; exports.complete = complete; exports.concatUint8Arrays = concatUint8Arrays; exports.deepEquals = deepEquals; exports.error = error; exports.event = event; exports.formatDateToUtcYYYYMMDD = _chunkFNITWKARcjs.formatDateToUtcYYYYMMDD; exports.getInMemoryEventStore = getInMemoryEventStore; exports.getInMemoryMessageBus = getInMemoryMessageBus; exports.globalStreamCaughtUp = globalStreamCaughtUp; exports.ignore = ignore; exports.inlineProjections = inlineProjections; exports.isEquatable = isEquatable; exports.isErrorConstructor = _chunkFNITWKARcjs.isErrorConstructor; exports.isExpectedVersionConflictError = isExpectedVersionConflictError; exports.isGlobalStreamCaughtUp = isGlobalStreamCaughtUp; exports.isNotInternalEvent = isNotInternalEvent; exports.isNumber = _chunkFNITWKARcjs.isNumber; exports.isPluginConfig = _chunkFNITWKARcjs.isPluginConfig; exports.isString = _chunkFNITWKARcjs.isString; exports.isSubscriptionEvent = isSubscriptionEvent; exports.isSubset = isSubset; exports.isValidYYYYMMDD = _chunkFNITWKARcjs.isValidYYYYMMDD; exports.matchesExpectedVersion = matchesExpectedVersion; exports.merge = merge; exports.nulloSessionFactory = nulloSessionFactory; exports.parseDateFromUtcYYYYMMDD = _chunkFNITWKARcjs.parseDateFromUtcYYYYMMDD; exports.projection = projection; exports.projections = projections; exports.publish = publish; exports.reply = reply; exports.restream = restream; exports.schedule = schedule; exports.send = send; exports.streamGenerators = streamGenerators; exports.streamTrackingGlobalPosition = streamTrackingGlobalPosition; exports.streamTransformations = streamTransformations; exports.sum = sum; exports.verifyThat = verifyThat;
1374
1403
  //# sourceMappingURL=index.cjs.map