--- policy: /ce/unit-test/date-time-from logic: /ce/unit-test/date-time-from/unit-test.logic.yaml executionTime: 2026-03-16T13:24:54.990375257Z generationMs: 98 executionMs: 1683 rows: - id: Valid-ISO-8601 match: true status: expected: COMPLIANT actual: COMPLIANT conditionIndex: expected: 199 actual: 199 conditionText: expected: "unitTest(Valid-ISO-8601): '2024-10-27T14:30:00Z'.asDateTime() ==\ \ '2024-10-27T14:30:00Z'" actual: "unitTest(Valid-ISO-8601): '2024-10-27T14:30:00Z'.asDateTime() == '2024-10-27T14:30:00Z'" runtimeError: {} - id: Valid-Timezone-Offset match: true status: expected: COMPLIANT actual: COMPLIANT conditionIndex: expected: 299 actual: 299 conditionText: expected: "unitTest(Valid-Timezone-Offset): '2024-10-27T10:00:00-05:00'.asDateTime()\ \ == '2024-10-27T15:00:00Z'" actual: "unitTest(Valid-Timezone-Offset): '2024-10-27T10:00:00-05:00'.asDateTime()\ \ == '2024-10-27T15:00:00Z'" runtimeError: {} - id: Valid-Date-Only match: true status: expected: COMPLIANT actual: COMPLIANT conditionIndex: expected: 399 actual: 399 conditionText: expected: "unitTest(Valid-Date-Only): '2024-10-27'.asDateTime() == '2024-10-27T00:00:00Z'" actual: "unitTest(Valid-Date-Only): '2024-10-27'.asDateTime() == '2024-10-27T00:00:00Z'" runtimeError: {} - id: Valid-Milliseconds match: true status: expected: COMPLIANT actual: COMPLIANT conditionIndex: expected: 499 actual: 499 conditionText: expected: "unitTest(Valid-Milliseconds): '2024-10-27T14:30:00.123Z'.asDateTime()\ \ == '2024-10-27T14:30:00.123Z'" actual: "unitTest(Valid-Milliseconds): '2024-10-27T14:30:00.123Z'.asDateTime()\ \ == '2024-10-27T14:30:00.123Z'" runtimeError: {} - id: Null-Value-Empty-String match: true status: expected: UNDETERMINED actual: UNDETERMINED conditionIndex: expected: 501 actual: 501 conditionText: expected: '''''.isEmpty()' actual: '''''.isEmpty()' runtimeError: {} - id: Null-Value-Custom-With-IsEmpty-Check match: true status: expected: UNDETERMINED actual: UNDETERMINED conditionIndex: expected: 601 actual: 601 conditionText: expected: '''N/A''.isEmpty()' actual: '''N/A''.isEmpty()' runtimeError: {} - id: Null-Value-Custom-No-IsEmpty-Check match: true status: expected: COMPLIANT actual: COMPLIANT conditionIndex: expected: 799 actual: 799 conditionText: expected: "unitTest(Null-Value-Custom-No-IsEmpty-Check): 'N/A'.asDateTime().isEmpty()" actual: "unitTest(Null-Value-Custom-No-IsEmpty-Check): 'N/A'.asDateTime().isEmpty()" runtimeError: {} - id: Null-Value-Null-Input match: true status: expected: UNDETERMINED actual: UNDETERMINED conditionIndex: expected: 801 actual: 801 conditionText: expected: null.isEmpty() actual: null.isEmpty() runtimeError: {} - id: Null-Value-Empty-Whitespace match: true status: expected: UNDETERMINED actual: UNDETERMINED conditionIndex: expected: 901 actual: 901 conditionText: expected: ''' ''.isEmpty()' actual: ''' ''.isEmpty()' runtimeError: {} - id: Invalid-Format match: true status: expected: UNDETERMINED actual: UNDETERMINED conditionIndex: expected: 1002 actual: 1002 conditionText: expected: '''invalid date''.checkIso8601()' actual: '''invalid date''.checkIso8601()' runtimeError: {} usedFiles: - path: /ce/unit-test/date-time-from/policy.yaml md5Hash: 02C9D3285287018900B7C99244EA412B content: | --- names: full: DATE_TIME_FROM Unit Tests contextual: DATE_TIME_FROM description: "Unit tests for DATE_TIME_FROM operation" - path: /ce/unit-test/date-time-from/unit-test.logic.yaml md5Hash: B28AAC3CA423F11EE0F32444E99CD4FF content: |- --- inputType: CA10__CaAwsInstance__c conditions: - status: COMPLIANT currentStateMessage: "Valid ISO 8601 date and time" check: UNIT_TEST: id: Valid-ISO-8601 expected: text: "unitTest(Valid-ISO-8601): '2024-10-27T14:30:00Z'.asDateTime() == '2024-10-27T14:30:00Z'" arg: IS_EQUAL: left: DATE_TIME_FROM: arg: TEXT: "2024-10-27T14:30:00Z" format: "ISO_8601" undeterminedIf: invalidFormat: "Invalid date format" right: DATE_TIME: "2024-10-27T14:30:00Z" - status: COMPLIANT currentStateMessage: "Valid ISO 8601 with timezone offset" check: UNIT_TEST: id: Valid-Timezone-Offset expected: text: "unitTest(Valid-Timezone-Offset): '2024-10-27T10:00:00-05:00'.asDateTime() == '2024-10-27T15:00:00Z'" arg: IS_EQUAL: left: DATE_TIME_FROM: arg: TEXT: "2024-10-27T10:00:00-05:00" # 10:00 AM EST = 3:00 PM UTC format: "ISO_8601" undeterminedIf: invalidFormat: "Invalid date format" right: DATE_TIME: "2024-10-27T15:00:00Z" # Expected result in UTC - status: COMPLIANT currentStateMessage: "Valid ISO 8601 date only" check: UNIT_TEST: id: Valid-Date-Only expected: text: "unitTest(Valid-Date-Only): '2024-10-27'.asDateTime() == '2024-10-27T00:00:00Z'" arg: IS_EQUAL: left: DATE_TIME_FROM: arg: TEXT: "2024-10-27" format: "ISO_8601" undeterminedIf: invalidFormat: "Invalid date format" right: DATE_TIME: "2024-10-27T00:00:00Z" - status: COMPLIANT currentStateMessage: "Valid ISO 8601 with milliseconds" check: UNIT_TEST: id: Valid-Milliseconds expected: text: "unitTest(Valid-Milliseconds): '2024-10-27T14:30:00.123Z'.asDateTime() == '2024-10-27T14:30:00.123Z'" arg: IS_EQUAL: left: DATE_TIME_FROM: arg: TEXT: "2024-10-27T14:30:00.123Z" format: "ISO_8601" undeterminedIf: invalidFormat: "Invalid date format" right: DATE_TIME: "2024-10-27T14:30:00.123Z" - status: COMPLIANT currentStateMessage: "Null value handling (empty string)" check: UNIT_TEST: id: Null-Value-Empty-String expected: status: UNDETERMINED subIndex: 1 text: "''.isEmpty()" arg: IS_EMPTY: arg: DATE_TIME_FROM: arg: TEXT: "" format: "ISO_8601" nullValues: - "N/A" - "Unknown" undeterminedIf: isEmpty: "Input is empty" invalidFormat: "Invalid date format" - status: COMPLIANT currentStateMessage: "Null value handling (custom null value) when also setting undeterminedIf.isEmpty" check: UNIT_TEST: id: Null-Value-Custom-With-IsEmpty-Check expected: status: UNDETERMINED subIndex: 1 text: "'N/A'.isEmpty()" arg: IS_EMPTY: arg: DATE_TIME_FROM: arg: TEXT: "N/A" format: "ISO_8601" nullValues: - "N/A" - "Unknown" undeterminedIf: isEmpty: "Input is empty" invalidFormat: "Invalid date format" - status: COMPLIANT currentStateMessage: "Null value handling (custom null value) without undeterminedIf.isEmpty" check: UNIT_TEST: id: Null-Value-Custom-No-IsEmpty-Check expected: text: "unitTest(Null-Value-Custom-No-IsEmpty-Check): 'N/A'.asDateTime().isEmpty()" arg: IS_EMPTY: arg: DATE_TIME_FROM: arg: TEXT: "N/A" format: "ISO_8601" nullValues: - "N/A" - "Unknown" undeterminedIf: invalidFormat: "Invalid date format" - status: COMPLIANT currentStateMessage: "Null value handling (null input)" check: UNIT_TEST: id: Null-Value-Null-Input expected: status: UNDETERMINED subIndex: 1 text: "null.isEmpty()" arg: IS_EMPTY: arg: DATE_TIME_FROM: arg: UNIT_TEST_NULL: returnType: TEXT format: "ISO_8601" nullValues: - "N/A" - "Unknown" undeterminedIf: isEmpty: "Input is empty" invalidFormat: "Invalid date format" - status: COMPLIANT currentStateMessage: "Null value handling (whitespace string)" check: UNIT_TEST: id: Null-Value-Empty-Whitespace expected: status: UNDETERMINED subIndex: 1 text: "' '.isEmpty()" arg: IS_EMPTY: arg: DATE_TIME_FROM: arg: TEXT: " " format: "ISO_8601" nullValues: - "N/A" - "Unknown" undeterminedIf: isEmpty: "Input is empty" invalidFormat: "Invalid date format" - status: COMPLIANT currentStateMessage: "Invalid format - Undetermined" check: UNIT_TEST: id: Invalid-Format expected: status: UNDETERMINED subIndex: 2 text: "'invalid date'.checkIso8601()" arg: IS_EQUAL: left: DATE_TIME_FROM: arg: TEXT: "invalid date" format: "ISO_8601" undeterminedIf: isEmpty: "Input is empty" invalidFormat: "Invalid date format" right: DATE_TIME: "2000-01-01T00:00:00Z" otherwise: status: INCOMPLIANT currentStateMessage: Test Failed remediationMessage: Developer Fix Required script: |- CREATE TEMP FUNCTION mock_ExpectedResult() RETURNS ARRAY >> DETERMINISTIC LANGUAGE js AS r""" return [ { "Id" : "Valid-ISO-8601", "expectedResult" : { "status" : "COMPLIANT", "conditionIndex" : 199, "conditionText" : "unitTest(Valid-ISO-8601): '2024-10-27T14:30:00Z'.asDateTime() == '2024-10-27T14:30:00Z'", "runtimeError" : null } }, { "Id" : "Valid-Timezone-Offset", "expectedResult" : { "status" : "COMPLIANT", "conditionIndex" : 299, "conditionText" : "unitTest(Valid-Timezone-Offset): '2024-10-27T10:00:00-05:00'.asDateTime() == '2024-10-27T15:00:00Z'", "runtimeError" : null } }, { "Id" : "Valid-Date-Only", "expectedResult" : { "status" : "COMPLIANT", "conditionIndex" : 399, "conditionText" : "unitTest(Valid-Date-Only): '2024-10-27'.asDateTime() == '2024-10-27T00:00:00Z'", "runtimeError" : null } }, { "Id" : "Valid-Milliseconds", "expectedResult" : { "status" : "COMPLIANT", "conditionIndex" : 499, "conditionText" : "unitTest(Valid-Milliseconds): '2024-10-27T14:30:00.123Z'.asDateTime() == '2024-10-27T14:30:00.123Z'", "runtimeError" : null } }, { "Id" : "Null-Value-Empty-String", "expectedResult" : { "status" : "UNDETERMINED", "conditionIndex" : 501, "conditionText" : "''.isEmpty()", "runtimeError" : null } }, { "Id" : "Null-Value-Custom-With-IsEmpty-Check", "expectedResult" : { "status" : "UNDETERMINED", "conditionIndex" : 601, "conditionText" : "'N/A'.isEmpty()", "runtimeError" : null } }, { "Id" : "Null-Value-Custom-No-IsEmpty-Check", "expectedResult" : { "status" : "COMPLIANT", "conditionIndex" : 799, "conditionText" : "unitTest(Null-Value-Custom-No-IsEmpty-Check): 'N/A'.asDateTime().isEmpty()", "runtimeError" : null } }, { "Id" : "Null-Value-Null-Input", "expectedResult" : { "status" : "UNDETERMINED", "conditionIndex" : 801, "conditionText" : "null.isEmpty()", "runtimeError" : null } }, { "Id" : "Null-Value-Empty-Whitespace", "expectedResult" : { "status" : "UNDETERMINED", "conditionIndex" : 901, "conditionText" : "' '.isEmpty()", "runtimeError" : null } }, { "Id" : "Invalid-Format", "expectedResult" : { "status" : "UNDETERMINED", "conditionIndex" : 1002, "conditionText" : "'invalid date'.checkIso8601()", "runtimeError" : null } } ]; """; CREATE TEMP FUNCTION mock_CA10__CaAwsInstance__c() RETURNS ARRAY >> DETERMINISTIC LANGUAGE js AS r""" return [ { "context" : { "snapshotTime" : new Date("2024-01-01T00:00:00.000Z") }, "Id" : "Valid-ISO-8601" }, { "context" : { "snapshotTime" : new Date("2024-01-01T00:00:00.000Z") }, "Id" : "Valid-Timezone-Offset" }, { "context" : { "snapshotTime" : new Date("2024-01-01T00:00:00.000Z") }, "Id" : "Valid-Date-Only" }, { "context" : { "snapshotTime" : new Date("2024-01-01T00:00:00.000Z") }, "Id" : "Valid-Milliseconds" }, { "context" : { "snapshotTime" : new Date("2024-01-01T00:00:00.000Z") }, "Id" : "Null-Value-Empty-String" }, { "context" : { "snapshotTime" : new Date("2024-01-01T00:00:00.000Z") }, "Id" : "Null-Value-Custom-With-IsEmpty-Check" }, { "context" : { "snapshotTime" : new Date("2024-01-01T00:00:00.000Z") }, "Id" : "Null-Value-Custom-No-IsEmpty-Check" }, { "context" : { "snapshotTime" : new Date("2024-01-01T00:00:00.000Z") }, "Id" : "Null-Value-Null-Input" }, { "context" : { "snapshotTime" : new Date("2024-01-01T00:00:00.000Z") }, "Id" : "Null-Value-Empty-Whitespace" }, { "context" : { "snapshotTime" : new Date("2024-01-01T00:00:00.000Z") }, "Id" : "Invalid-Format" } ]; """; CREATE TEMP FUNCTION process_CA10__CaAwsInstance__c( obj STRUCT< CA10__disappearanceTime__c TIMESTAMP, Id STRING >, snapshotTime TIMESTAMP ) RETURNS STRUCT DETERMINISTIC LANGUAGE js AS r""" var IsEmptyLib = new function () { this.simpleIsEmpty = function(arg) { return arg == null; }; this.simpleIsNotEmpty = function(arg) { return arg != null; }; }(); var TemporalLib = new function () { var iso8601regex = /^([\+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])((:?)[0-5]\d)?|24\:?00)([\.,]\d+(?!:))?)?(\17[0-5]\d([\.,]\d+)?)?([zZ]|([\+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/ this.checkIso8601 = function(arg) { return arg == null || iso8601regex.test(arg); }; this.parseIso8601 = function(arg) { return arg == null ? null: new Date(arg); }; this.replaceNullValues = function(arg, nullValues) { for (var i = 0; i < nullValues.length; i++) { if (TextLib.equal(arg, nullValues[i])) { return null; } } return arg; }; }(); var TextLib = new function () { this.normalize = function(arg) { return arg == null ? '' : arg.replace(/\s+/g, ' ').trim().toLowerCase(); }; this.isEmpty = function(arg) { return this.normalize(arg) == ''; }; this.isNotEmpty = function(arg) { return this.normalize(arg) != ''; }; this.equal = function(left, right) { return this.normalize(left) == this.normalize(right); }; this.notEqual = function(left, right) { return this.normalize(left) != this.normalize(right); }; this.startsWith = function(arg, substring) { return this.normalize(arg).startsWith(this.normalize(substring)); }; this.endsWith = function(arg, substring) { return this.normalize(arg).endsWith(this.normalize(substring)); }; this.contains = function(arg, substring) { return this.normalize(arg).includes(this.normalize(substring)); }; this.containsAll = function(arg, substrings) { if (substrings == null || substrings.length === 0) return false; let normalizedArg = this.normalize(arg); return substrings.every(sub => normalizedArg.includes(this.normalize(sub))); }; this.containsAny = function(arg, substrings) { if (substrings == null || substrings.length === 0) return false; let normalizedArg = this.normalize(arg); return substrings.some(sub => normalizedArg.includes(this.normalize(sub))); }; }(); var references1 = []; // condition[0], conditionIndex:[0..99] references1.push('Deleted From AWS [CA10__disappearanceTime__c]: ' + obj.CA10__disappearanceTime__c); if (obj.CA10__disappearanceTime__c != null) { return {status: 'DISAPPEARED', conditionIndex: 99, conditionText: "isDisappeared(CA10__disappearanceTime__c)", currentStateMessage: "Object is deleted in the source", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } // condition[1], conditionIndex:[100..199] function dateChecked2() { var dateTimeFrom3 = '2024-10-27T14:30:00Z'; if (!TemporalLib.checkIso8601(dateTimeFrom3)) { throw new Error("UNDETERMINED condition:101", {cause: {status: 'UNDETERMINED', conditionIndex: 101, conditionText: "'2024-10-27T14:30:00Z'.checkIso8601()", currentStateMessage: "Invalid date format", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}}); } return TemporalLib.parseIso8601(dateTimeFrom3); } function dateTimeEqual4() { var equalLeft5 = dateChecked2(); var equalRight6 = TemporalLib.parseIso8601('2024-10-27T14:30:00Z'); return (equalLeft5 == null && equalRight6 == null) || (equalLeft5 != null && equalRight6 != null && equalLeft5.getTime() == equalRight6.getTime()); } try { if (obj.Id == 'Valid-ISO-8601' && dateTimeEqual4()) { return {status: 'COMPLIANT', conditionIndex: 199, conditionText: "unitTest(Valid-ISO-8601): '2024-10-27T14:30:00Z'.asDateTime() == '2024-10-27T14:30:00Z'", currentStateMessage: "Valid ISO 8601 date and time", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } } catch (err) { if (err.cause && err.cause.status) { return err.cause; } else { throw err; } } // condition[2], conditionIndex:[200..299] function dateChecked7() { var dateTimeFrom8 = '2024-10-27T10:00:00-05:00'; if (!TemporalLib.checkIso8601(dateTimeFrom8)) { throw new Error("UNDETERMINED condition:201", {cause: {status: 'UNDETERMINED', conditionIndex: 201, conditionText: "'2024-10-27T10:00:00-05:00'.checkIso8601()", currentStateMessage: "Invalid date format", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}}); } return TemporalLib.parseIso8601(dateTimeFrom8); } function dateTimeEqual9() { var equalLeft10 = dateChecked7(); var equalRight11 = TemporalLib.parseIso8601('2024-10-27T15:00:00Z'); return (equalLeft10 == null && equalRight11 == null) || (equalLeft10 != null && equalRight11 != null && equalLeft10.getTime() == equalRight11.getTime()); } try { if (obj.Id == 'Valid-Timezone-Offset' && dateTimeEqual9()) { return {status: 'COMPLIANT', conditionIndex: 299, conditionText: "unitTest(Valid-Timezone-Offset): '2024-10-27T10:00:00-05:00'.asDateTime() == '2024-10-27T15:00:00Z'", currentStateMessage: "Valid ISO 8601 with timezone offset", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } } catch (err) { if (err.cause && err.cause.status) { return err.cause; } else { throw err; } } // condition[3], conditionIndex:[300..399] function dateChecked12() { var dateTimeFrom13 = '2024-10-27'; if (!TemporalLib.checkIso8601(dateTimeFrom13)) { throw new Error("UNDETERMINED condition:301", {cause: {status: 'UNDETERMINED', conditionIndex: 301, conditionText: "'2024-10-27'.checkIso8601()", currentStateMessage: "Invalid date format", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}}); } return TemporalLib.parseIso8601(dateTimeFrom13); } function dateTimeEqual14() { var equalLeft15 = dateChecked12(); var equalRight16 = TemporalLib.parseIso8601('2024-10-27T00:00:00Z'); return (equalLeft15 == null && equalRight16 == null) || (equalLeft15 != null && equalRight16 != null && equalLeft15.getTime() == equalRight16.getTime()); } try { if (obj.Id == 'Valid-Date-Only' && dateTimeEqual14()) { return {status: 'COMPLIANT', conditionIndex: 399, conditionText: "unitTest(Valid-Date-Only): '2024-10-27'.asDateTime() == '2024-10-27T00:00:00Z'", currentStateMessage: "Valid ISO 8601 date only", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } } catch (err) { if (err.cause && err.cause.status) { return err.cause; } else { throw err; } } // condition[4], conditionIndex:[400..499] function dateChecked17() { var dateTimeFrom18 = '2024-10-27T14:30:00.123Z'; if (!TemporalLib.checkIso8601(dateTimeFrom18)) { throw new Error("UNDETERMINED condition:401", {cause: {status: 'UNDETERMINED', conditionIndex: 401, conditionText: "'2024-10-27T14:30:00.123Z'.checkIso8601()", currentStateMessage: "Invalid date format", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}}); } return TemporalLib.parseIso8601(dateTimeFrom18); } function dateTimeEqual19() { var equalLeft20 = dateChecked17(); var equalRight21 = TemporalLib.parseIso8601('2024-10-27T14:30:00.123Z'); return (equalLeft20 == null && equalRight21 == null) || (equalLeft20 != null && equalRight21 != null && equalLeft20.getTime() == equalRight21.getTime()); } try { if (obj.Id == 'Valid-Milliseconds' && dateTimeEqual19()) { return {status: 'COMPLIANT', conditionIndex: 499, conditionText: "unitTest(Valid-Milliseconds): '2024-10-27T14:30:00.123Z'.asDateTime() == '2024-10-27T14:30:00.123Z'", currentStateMessage: "Valid ISO 8601 with milliseconds", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } } catch (err) { if (err.cause && err.cause.status) { return err.cause; } else { throw err; } } // condition[5], conditionIndex:[500..599] function dateChecked22() { var dateTimeFrom23 = ''; dateTimeFrom23 = TemporalLib.replaceNullValues(dateTimeFrom23, ['N/A', 'Unknown']); if (TextLib.isEmpty(dateTimeFrom23)) { throw new Error("UNDETERMINED condition:501", {cause: {status: 'UNDETERMINED', conditionIndex: 501, conditionText: "''.isEmpty()", currentStateMessage: "Input is empty", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}}); } if (!TemporalLib.checkIso8601(dateTimeFrom23)) { throw new Error("UNDETERMINED condition:502", {cause: {status: 'UNDETERMINED', conditionIndex: 502, conditionText: "''.checkIso8601()", currentStateMessage: "Invalid date format", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}}); } return TemporalLib.parseIso8601(dateTimeFrom23); } try { if (obj.Id == 'Null-Value-Empty-String' && IsEmptyLib.simpleIsEmpty(dateChecked22())) { return {status: 'COMPLIANT', conditionIndex: 599, conditionText: "unitTest(Null-Value-Empty-String): ''.asDateTime().isEmpty()", currentStateMessage: "Null value handling (empty string)", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } } catch (err) { if (err.cause && err.cause.status) { return err.cause; } else { throw err; } } // condition[6], conditionIndex:[600..699] function dateChecked24() { var dateTimeFrom25 = 'N/A'; dateTimeFrom25 = TemporalLib.replaceNullValues(dateTimeFrom25, ['N/A', 'Unknown']); if (TextLib.isEmpty(dateTimeFrom25)) { throw new Error("UNDETERMINED condition:601", {cause: {status: 'UNDETERMINED', conditionIndex: 601, conditionText: "'N/A'.isEmpty()", currentStateMessage: "Input is empty", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}}); } if (!TemporalLib.checkIso8601(dateTimeFrom25)) { throw new Error("UNDETERMINED condition:602", {cause: {status: 'UNDETERMINED', conditionIndex: 602, conditionText: "'N/A'.checkIso8601()", currentStateMessage: "Invalid date format", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}}); } return TemporalLib.parseIso8601(dateTimeFrom25); } try { if (obj.Id == 'Null-Value-Custom-With-IsEmpty-Check' && IsEmptyLib.simpleIsEmpty(dateChecked24())) { return {status: 'COMPLIANT', conditionIndex: 699, conditionText: "unitTest(Null-Value-Custom-With-IsEmpty-Check): 'N/A'.asDateTime().isEmpty()", currentStateMessage: "Null value handling (custom null value) when also setting undeterminedIf.isEmpty", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } } catch (err) { if (err.cause && err.cause.status) { return err.cause; } else { throw err; } } // condition[7], conditionIndex:[700..799] function dateChecked26() { var dateTimeFrom27 = 'N/A'; dateTimeFrom27 = TemporalLib.replaceNullValues(dateTimeFrom27, ['N/A', 'Unknown']); if (!TemporalLib.checkIso8601(dateTimeFrom27)) { throw new Error("UNDETERMINED condition:701", {cause: {status: 'UNDETERMINED', conditionIndex: 701, conditionText: "'N/A'.checkIso8601()", currentStateMessage: "Invalid date format", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}}); } return TemporalLib.parseIso8601(dateTimeFrom27); } try { if (obj.Id == 'Null-Value-Custom-No-IsEmpty-Check' && IsEmptyLib.simpleIsEmpty(dateChecked26())) { return {status: 'COMPLIANT', conditionIndex: 799, conditionText: "unitTest(Null-Value-Custom-No-IsEmpty-Check): 'N/A'.asDateTime().isEmpty()", currentStateMessage: "Null value handling (custom null value) without undeterminedIf.isEmpty", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } } catch (err) { if (err.cause && err.cause.status) { return err.cause; } else { throw err; } } // condition[8], conditionIndex:[800..899] function dateChecked28() { var dateTimeFrom29 = null; dateTimeFrom29 = TemporalLib.replaceNullValues(dateTimeFrom29, ['N/A', 'Unknown']); if (TextLib.isEmpty(dateTimeFrom29)) { throw new Error("UNDETERMINED condition:801", {cause: {status: 'UNDETERMINED', conditionIndex: 801, conditionText: "null.isEmpty()", currentStateMessage: "Input is empty", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}}); } if (!TemporalLib.checkIso8601(dateTimeFrom29)) { throw new Error("UNDETERMINED condition:802", {cause: {status: 'UNDETERMINED', conditionIndex: 802, conditionText: "null.checkIso8601()", currentStateMessage: "Invalid date format", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}}); } return TemporalLib.parseIso8601(dateTimeFrom29); } try { if (obj.Id == 'Null-Value-Null-Input' && IsEmptyLib.simpleIsEmpty(dateChecked28())) { return {status: 'COMPLIANT', conditionIndex: 899, conditionText: "unitTest(Null-Value-Null-Input): null.asDateTime().isEmpty()", currentStateMessage: "Null value handling (null input)", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } } catch (err) { if (err.cause && err.cause.status) { return err.cause; } else { throw err; } } // condition[9], conditionIndex:[900..999] function dateChecked30() { var dateTimeFrom31 = ' '; dateTimeFrom31 = TemporalLib.replaceNullValues(dateTimeFrom31, ['N/A', 'Unknown']); if (TextLib.isEmpty(dateTimeFrom31)) { throw new Error("UNDETERMINED condition:901", {cause: {status: 'UNDETERMINED', conditionIndex: 901, conditionText: "' '.isEmpty()", currentStateMessage: "Input is empty", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}}); } if (!TemporalLib.checkIso8601(dateTimeFrom31)) { throw new Error("UNDETERMINED condition:902", {cause: {status: 'UNDETERMINED', conditionIndex: 902, conditionText: "' '.checkIso8601()", currentStateMessage: "Invalid date format", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}}); } return TemporalLib.parseIso8601(dateTimeFrom31); } try { if (obj.Id == 'Null-Value-Empty-Whitespace' && IsEmptyLib.simpleIsEmpty(dateChecked30())) { return {status: 'COMPLIANT', conditionIndex: 999, conditionText: "unitTest(Null-Value-Empty-Whitespace): ' '.asDateTime().isEmpty()", currentStateMessage: "Null value handling (whitespace string)", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } } catch (err) { if (err.cause && err.cause.status) { return err.cause; } else { throw err; } } // condition[10], conditionIndex:[1000..1099] function dateChecked32() { var dateTimeFrom33 = 'invalid date'; if (TextLib.isEmpty(dateTimeFrom33)) { throw new Error("UNDETERMINED condition:1001", {cause: {status: 'UNDETERMINED', conditionIndex: 1001, conditionText: "'invalid date'.isEmpty()", currentStateMessage: "Input is empty", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}}); } if (!TemporalLib.checkIso8601(dateTimeFrom33)) { throw new Error("UNDETERMINED condition:1002", {cause: {status: 'UNDETERMINED', conditionIndex: 1002, conditionText: "'invalid date'.checkIso8601()", currentStateMessage: "Invalid date format", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}}); } return TemporalLib.parseIso8601(dateTimeFrom33); } function dateTimeEqual34() { var equalLeft35 = dateChecked32(); var equalRight36 = TemporalLib.parseIso8601('2000-01-01T00:00:00Z'); return (equalLeft35 == null && equalRight36 == null) || (equalLeft35 != null && equalRight36 != null && equalLeft35.getTime() == equalRight36.getTime()); } try { if (obj.Id == 'Invalid-Format' && dateTimeEqual34()) { return {status: 'COMPLIANT', conditionIndex: 1099, conditionText: "unitTest(Invalid-Format): 'invalid date'.asDateTime() == '2000-01-01T00:00:00Z'", currentStateMessage: "Invalid format - Undetermined", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } } catch (err) { if (err.cause && err.cause.status) { return err.cause; } else { throw err; } } return {status: 'INCOMPLIANT', conditionIndex: 1100, conditionText: "otherwise", currentStateMessage: "Test Failed", currentStateReferences: references1.join('\n'), remediation: "Developer Fix Required", runtimeError: null}; """; SELECT expectedResult.Id as Id, IF ( IFNULL(expectedResult.expectedResult.status, '') = IFNULL(sObject.result.status, '') AND IFNULL(expectedResult.expectedResult.conditionIndex, -1) = IFNULL(sObject.result.conditionIndex, -1) AND IFNULL(expectedResult.expectedResult.conditionText, '') = IFNULL(sObject.result.conditionText, '') AND IFNULL(expectedResult.expectedResult.runtimeError, '') = IFNULL(sObject.result.runtimeError, ''), "MATCH", "FAIL" ) as match, expectedResult.expectedResult.status as expectedStatus, sObject.result.status as actualStatus, expectedResult.expectedResult.conditionIndex as expectedConditionIndex, sObject.result.conditionIndex as actualConditionIndex, expectedResult.expectedResult.conditionText as expectedConditionText, sObject.result.conditionText as actualConditionText, expectedResult.expectedResult.runtimeError as expectedRuntimeError, sObject.result.runtimeError as actualRuntimeError FROM UNNEST(mock_ExpectedResult()) expectedResult LEFT JOIN ( SELECT sObject.CA10__disappearanceTime__c AS CA10__disappearanceTime__c, sObject.Id AS Id, process_CA10__CaAwsInstance__c( STRUCT( sObject.CA10__disappearanceTime__c AS CA10__disappearanceTime__c, sObject.Id AS Id ), sObject.context.snapshotTime ) as result FROM UNNEST(mock_CA10__CaAwsInstance__c()) AS sObject ) sObject ON sObject.Id = expectedResult.Id;