@osdk/client 2.6.0-beta.8 → 2.6.0-rc.14
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/CHANGELOG.md +172 -0
- package/build/browser/MinimalClientContext.js.map +1 -1
- package/build/browser/actions/applyAction.js +0 -4
- package/build/browser/actions/applyAction.js.map +1 -1
- package/build/browser/createClient.js +1 -2
- package/build/browser/createClient.js.map +1 -1
- package/build/browser/createClient.test.js +19 -1
- package/build/browser/createClient.test.js.map +1 -1
- package/build/browser/createMinimalClient.js +2 -3
- package/build/browser/createMinimalClient.js.map +1 -1
- package/build/browser/derivedProperties/createWithPropertiesObjectSet.js +1 -17
- package/build/browser/derivedProperties/createWithPropertiesObjectSet.js.map +1 -1
- package/build/browser/fetchMetadata.test.js +0 -11
- package/build/browser/fetchMetadata.test.js.map +1 -1
- package/build/browser/index.js +1 -1
- package/build/browser/index.js.map +1 -1
- package/build/browser/object/aggregate.js +1 -1
- package/build/browser/object/aggregate.js.map +1 -1
- package/build/browser/object/convertWireToOsdkObjects/BaseHolder.js.map +1 -1
- package/build/browser/object/convertWireToOsdkObjects/InterfaceHolder.js.map +1 -1
- package/build/browser/object/convertWireToOsdkObjects/createOsdkInterface.js +0 -4
- package/build/browser/object/convertWireToOsdkObjects/createOsdkInterface.js.map +1 -1
- package/build/browser/object/convertWireToOsdkObjects/createOsdkObject.js +0 -10
- package/build/browser/object/convertWireToOsdkObjects/createOsdkObject.js.map +1 -1
- package/build/browser/object/convertWireToOsdkObjects.test.js +0 -12
- package/build/browser/object/convertWireToOsdkObjects.test.js.map +1 -1
- package/build/browser/object/fetchPage.js +6 -3
- package/build/browser/object/fetchPage.js.map +1 -1
- package/build/browser/objectSet/createObjectSet.js +3 -3
- package/build/browser/objectSet/createObjectSet.js.map +1 -1
- package/build/browser/observable/ObservableClient.js.map +1 -1
- package/build/browser/observable/internal/Changes.js.map +1 -1
- package/build/browser/observable/internal/IntersectCanonicalizer.js +35 -0
- package/build/browser/observable/internal/IntersectCanonicalizer.js.map +1 -0
- package/build/browser/observable/internal/KnownCacheKey.js.map +1 -1
- package/build/browser/observable/internal/ObservableClientImpl.js +3 -0
- package/build/browser/observable/internal/ObservableClientImpl.js.map +1 -1
- package/build/browser/{object/formatting/propertyFormattingUtils.js → observable/internal/PivotCanonicalizer.js} +15 -21
- package/build/browser/observable/internal/PivotCanonicalizer.js.map +1 -0
- package/build/browser/observable/internal/Store.js +14 -2
- package/build/browser/observable/internal/Store.js.map +1 -1
- package/build/browser/observable/internal/WhereClauseCanonicalizer.js.map +1 -1
- package/build/browser/{object/formatting/formatBoolean.js → observable/internal/aggregation/AggregationCacheKey.js} +6 -7
- package/build/browser/observable/internal/aggregation/AggregationCacheKey.js.map +1 -0
- package/build/browser/observable/internal/aggregation/AggregationQuery.js +77 -0
- package/build/browser/observable/internal/aggregation/AggregationQuery.js.map +1 -0
- package/build/browser/observable/internal/aggregation/AggregationsHelper.js +54 -0
- package/build/browser/observable/internal/aggregation/AggregationsHelper.js.map +1 -0
- package/build/{esm/object/formatting/propertyFormattingUtils.js → browser/observable/internal/aggregation/ObjectAggregationQuery.js} +15 -21
- package/build/browser/observable/internal/aggregation/ObjectAggregationQuery.js.map +1 -0
- package/build/browser/observable/internal/base-list/BaseListQuery.js +4 -2
- package/build/browser/observable/internal/base-list/BaseListQuery.js.map +1 -1
- package/build/browser/observable/internal/getObjectTypesThatInvalidate.test.js +1 -1
- package/build/browser/observable/internal/getObjectTypesThatInvalidate.test.js.map +1 -1
- package/build/browser/observable/internal/links/LinksHelper.js +0 -3
- package/build/browser/observable/internal/links/LinksHelper.js.map +1 -1
- package/build/browser/observable/internal/list/ListCacheKey.js +2 -0
- package/build/browser/observable/internal/list/ListCacheKey.js.map +1 -1
- package/build/browser/observable/internal/list/ListQuery.js +19 -4
- package/build/browser/observable/internal/list/ListQuery.js.map +1 -1
- package/build/browser/observable/internal/list/ListQuery.test.js +277 -0
- package/build/browser/observable/internal/list/ListQuery.test.js.map +1 -0
- package/build/browser/observable/internal/list/ListQueryOptions.js.map +1 -1
- package/build/browser/observable/internal/list/ListsHelper.js +9 -3
- package/build/browser/observable/internal/list/ListsHelper.js.map +1 -1
- package/build/browser/observable/internal/list/ObjectListQuery.js +48 -9
- package/build/browser/observable/internal/list/ObjectListQuery.js.map +1 -1
- package/build/browser/observable/internal/objectset/ObjectSetQuery.js +7 -1
- package/build/browser/observable/internal/objectset/ObjectSetQuery.js.map +1 -1
- package/build/browser/observable/internal/objectset/ObjectSetQueryOptions.js.map +1 -1
- package/build/browser/observable/internal/testUtils/invalidateList.js +6 -1
- package/build/browser/observable/internal/testUtils/invalidateList.js.map +1 -1
- package/build/browser/observable/internal/testUtils.js +3 -1
- package/build/browser/observable/internal/testUtils.js.map +1 -1
- package/build/browser/ontology/loadActionMetadata.js +1 -3
- package/build/browser/ontology/loadActionMetadata.js.map +1 -1
- package/build/browser/ontology/loadFullObjectMetadata.js +1 -2
- package/build/browser/ontology/loadFullObjectMetadata.js.map +1 -1
- package/build/browser/ontology/loadInterfaceMetadata.js +1 -2
- package/build/browser/ontology/loadInterfaceMetadata.js.map +1 -1
- package/build/{esm/object/formatting/formatBoolean.js → browser/public/internal-node.js} +2 -7
- package/build/browser/public/internal-node.js.map +1 -0
- package/build/browser/public/unstable-do-not-use.js.map +1 -1
- package/build/browser/queries/applyQuery.js +7 -12
- package/build/browser/queries/applyQuery.js.map +1 -1
- package/build/browser/queries/types.js.map +1 -1
- package/build/browser/util/UserAgent.js +2 -2
- package/build/browser/util/UserAgent.js.map +1 -1
- package/build/browser/util/extractObjectOrInterfaceType.js +1 -1
- package/build/browser/util/extractObjectOrInterfaceType.js.map +1 -1
- package/build/browser/util/extractObjectOrInterfaceType.test.js +2 -2
- package/build/browser/util/extractObjectOrInterfaceType.test.js.map +1 -1
- package/build/cjs/{Client-CF85LpFu.d.cts → Client-DaUJl7jZ.d.cts} +1 -1
- package/build/cjs/{chunk-PCNVSZXT.cjs → chunk-6P7VLXH3.cjs} +161 -473
- package/build/cjs/chunk-6P7VLXH3.cjs.map +1 -0
- package/build/cjs/chunk-6SCDLAU2.cjs +57 -0
- package/build/cjs/chunk-6SCDLAU2.cjs.map +1 -0
- package/build/cjs/{chunk-HJV24UL2.cjs → chunk-S3HJUSQ7.cjs} +161 -52
- package/build/cjs/chunk-S3HJUSQ7.cjs.map +1 -0
- package/build/cjs/{createClient-mOlFts15.d.cts → createClient-MAHmo-Nv.d.cts} +1 -2
- package/build/cjs/{delay-QK4T7RVX.cjs → delay-KIUUJ5NJ.cjs} +4 -3
- package/build/cjs/delay-KIUUJ5NJ.cjs.map +1 -0
- package/build/cjs/index.cjs +17 -13
- package/build/cjs/index.cjs.map +1 -1
- package/build/cjs/index.d.cts +3 -3
- package/build/cjs/public/internal-node.cjs +193767 -0
- package/build/cjs/public/internal-node.cjs.map +1 -0
- package/build/cjs/public/internal-node.d.cts +29 -0
- package/build/cjs/public/internal.cjs +16 -9
- package/build/cjs/public/internal.cjs.map +1 -1
- package/build/cjs/public/internal.d.cts +1 -1
- package/build/cjs/public/unstable-do-not-use.cjs +1067 -709
- package/build/cjs/public/unstable-do-not-use.cjs.map +1 -1
- package/build/cjs/public/unstable-do-not-use.d.cts +69 -4
- package/build/esm/MinimalClientContext.js.map +1 -1
- package/build/esm/actions/applyAction.js +0 -4
- package/build/esm/actions/applyAction.js.map +1 -1
- package/build/esm/createClient.js +1 -2
- package/build/esm/createClient.js.map +1 -1
- package/build/esm/createClient.test.js +19 -1
- package/build/esm/createClient.test.js.map +1 -1
- package/build/esm/createMinimalClient.js +2 -3
- package/build/esm/createMinimalClient.js.map +1 -1
- package/build/esm/derivedProperties/createWithPropertiesObjectSet.js +1 -17
- package/build/esm/derivedProperties/createWithPropertiesObjectSet.js.map +1 -1
- package/build/esm/fetchMetadata.test.js +0 -11
- package/build/esm/fetchMetadata.test.js.map +1 -1
- package/build/esm/index.js +1 -1
- package/build/esm/index.js.map +1 -1
- package/build/esm/object/aggregate.js +1 -1
- package/build/esm/object/aggregate.js.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects/BaseHolder.js.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects/InterfaceHolder.js.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects/createOsdkInterface.js +0 -4
- package/build/esm/object/convertWireToOsdkObjects/createOsdkInterface.js.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects/createOsdkObject.js +0 -10
- package/build/esm/object/convertWireToOsdkObjects/createOsdkObject.js.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects.test.js +0 -12
- package/build/esm/object/convertWireToOsdkObjects.test.js.map +1 -1
- package/build/esm/object/fetchPage.js +6 -3
- package/build/esm/object/fetchPage.js.map +1 -1
- package/build/esm/objectSet/createObjectSet.js +3 -3
- package/build/esm/objectSet/createObjectSet.js.map +1 -1
- package/build/esm/observable/ObservableClient.js.map +1 -1
- package/build/esm/observable/internal/Changes.js.map +1 -1
- package/build/esm/observable/internal/IntersectCanonicalizer.js +35 -0
- package/build/esm/observable/internal/IntersectCanonicalizer.js.map +1 -0
- package/build/esm/observable/internal/KnownCacheKey.js.map +1 -1
- package/build/esm/observable/internal/ObservableClientImpl.js +3 -0
- package/build/esm/observable/internal/ObservableClientImpl.js.map +1 -1
- package/build/esm/observable/internal/PivotCanonicalizer.js +33 -0
- package/build/esm/observable/internal/PivotCanonicalizer.js.map +1 -0
- package/build/esm/observable/internal/Store.js +14 -2
- package/build/esm/observable/internal/Store.js.map +1 -1
- package/build/esm/observable/internal/WhereClauseCanonicalizer.js.map +1 -1
- package/build/esm/observable/internal/aggregation/AggregationCacheKey.js +22 -0
- package/build/esm/observable/internal/aggregation/AggregationCacheKey.js.map +1 -0
- package/build/esm/observable/internal/aggregation/AggregationQuery.js +77 -0
- package/build/esm/observable/internal/aggregation/AggregationQuery.js.map +1 -0
- package/build/esm/observable/internal/aggregation/AggregationsHelper.js +54 -0
- package/build/esm/observable/internal/aggregation/AggregationsHelper.js.map +1 -0
- package/build/esm/observable/internal/aggregation/ObjectAggregationQuery.js +33 -0
- package/build/esm/observable/internal/aggregation/ObjectAggregationQuery.js.map +1 -0
- package/build/esm/observable/internal/base-list/BaseListQuery.js +4 -2
- package/build/esm/observable/internal/base-list/BaseListQuery.js.map +1 -1
- package/build/esm/observable/internal/getObjectTypesThatInvalidate.test.js +1 -1
- package/build/esm/observable/internal/getObjectTypesThatInvalidate.test.js.map +1 -1
- package/build/esm/observable/internal/links/LinksHelper.js +0 -3
- package/build/esm/observable/internal/links/LinksHelper.js.map +1 -1
- package/build/esm/observable/internal/list/ListCacheKey.js +2 -0
- package/build/esm/observable/internal/list/ListCacheKey.js.map +1 -1
- package/build/esm/observable/internal/list/ListQuery.js +19 -4
- package/build/esm/observable/internal/list/ListQuery.js.map +1 -1
- package/build/esm/observable/internal/list/ListQuery.test.js +277 -0
- package/build/esm/observable/internal/list/ListQuery.test.js.map +1 -0
- package/build/esm/observable/internal/list/ListQueryOptions.js.map +1 -1
- package/build/esm/observable/internal/list/ListsHelper.js +9 -3
- package/build/esm/observable/internal/list/ListsHelper.js.map +1 -1
- package/build/esm/observable/internal/list/ObjectListQuery.js +48 -9
- package/build/esm/observable/internal/list/ObjectListQuery.js.map +1 -1
- package/build/esm/observable/internal/objectset/ObjectSetQuery.js +7 -1
- package/build/esm/observable/internal/objectset/ObjectSetQuery.js.map +1 -1
- package/build/esm/observable/internal/objectset/ObjectSetQueryOptions.js.map +1 -1
- package/build/esm/observable/internal/testUtils/invalidateList.js +6 -1
- package/build/esm/observable/internal/testUtils/invalidateList.js.map +1 -1
- package/build/esm/observable/internal/testUtils.js +3 -1
- package/build/esm/observable/internal/testUtils.js.map +1 -1
- package/build/esm/ontology/loadActionMetadata.js +1 -3
- package/build/esm/ontology/loadActionMetadata.js.map +1 -1
- package/build/esm/ontology/loadFullObjectMetadata.js +1 -2
- package/build/esm/ontology/loadFullObjectMetadata.js.map +1 -1
- package/build/esm/ontology/loadInterfaceMetadata.js +1 -2
- package/build/esm/ontology/loadInterfaceMetadata.js.map +1 -1
- package/build/esm/public/internal-node.js +18 -0
- package/build/esm/public/internal-node.js.map +1 -0
- package/build/esm/public/unstable-do-not-use.js.map +1 -1
- package/build/esm/queries/applyQuery.js +7 -12
- package/build/esm/queries/applyQuery.js.map +1 -1
- package/build/esm/queries/types.js.map +1 -1
- package/build/esm/util/UserAgent.js +2 -2
- package/build/esm/util/UserAgent.js.map +1 -1
- package/build/esm/util/extractObjectOrInterfaceType.js +1 -1
- package/build/esm/util/extractObjectOrInterfaceType.js.map +1 -1
- package/build/esm/util/extractObjectOrInterfaceType.test.js +2 -2
- package/build/esm/util/extractObjectOrInterfaceType.test.js.map +1 -1
- package/build/types/MinimalClientContext.d.ts +2 -3
- package/build/types/MinimalClientContext.d.ts.map +1 -1
- package/build/types/actions/applyAction.d.ts.map +1 -1
- package/build/types/createClient.d.ts +0 -1
- package/build/types/createClient.d.ts.map +1 -1
- package/build/types/index.d.ts +1 -1
- package/build/types/index.d.ts.map +1 -1
- package/build/types/observable/ObservableClient.d.ts +62 -1
- package/build/types/observable/ObservableClient.d.ts.map +1 -1
- package/build/types/observable/internal/Changes.d.ts +4 -3
- package/build/types/observable/internal/Changes.d.ts.map +1 -1
- package/build/types/observable/internal/IntersectCanonicalizer.d.ts +18 -0
- package/build/types/observable/internal/IntersectCanonicalizer.d.ts.map +1 -0
- package/build/types/observable/internal/KnownCacheKey.d.ts +2 -1
- package/build/types/observable/internal/KnownCacheKey.d.ts.map +1 -1
- package/build/types/observable/internal/PivotCanonicalizer.d.ts +10 -0
- package/build/types/observable/internal/PivotCanonicalizer.d.ts.map +1 -0
- package/build/types/observable/internal/Store.d.ts +6 -0
- package/build/types/observable/internal/Store.d.ts.map +1 -1
- package/build/types/observable/internal/WhereClauseCanonicalizer.d.ts.map +1 -1
- package/build/types/observable/internal/aggregation/AggregationCacheKey.d.ts +12 -0
- package/build/types/observable/internal/aggregation/AggregationCacheKey.d.ts.map +1 -0
- package/build/types/observable/internal/aggregation/AggregationQuery.d.ts +49 -0
- package/build/types/observable/internal/aggregation/AggregationQuery.d.ts.map +1 -0
- package/build/types/observable/internal/aggregation/AggregationsHelper.d.ts +37 -0
- package/build/types/observable/internal/aggregation/AggregationsHelper.d.ts.map +1 -0
- package/build/types/observable/internal/aggregation/ObjectAggregationQuery.d.ts +5 -0
- package/build/types/observable/internal/aggregation/ObjectAggregationQuery.d.ts.map +1 -0
- package/build/types/observable/internal/base-list/BaseListQuery.d.ts.map +1 -1
- package/build/types/observable/internal/links/LinksHelper.d.ts +0 -4
- package/build/types/observable/internal/links/LinksHelper.d.ts.map +1 -1
- package/build/types/observable/internal/list/ListCacheKey.d.ts +4 -1
- package/build/types/observable/internal/list/ListCacheKey.d.ts.map +1 -1
- package/build/types/observable/internal/list/ListQuery.d.ts +4 -1
- package/build/types/observable/internal/list/ListQuery.d.ts.map +1 -1
- package/build/types/observable/internal/list/ListQuery.test.d.ts.map +1 -0
- package/build/types/observable/internal/list/ListQueryOptions.d.ts +10 -1
- package/build/types/observable/internal/list/ListQueryOptions.d.ts.map +1 -1
- package/build/types/observable/internal/list/ListsHelper.d.ts +5 -1
- package/build/types/observable/internal/list/ListsHelper.d.ts.map +1 -1
- package/build/types/observable/internal/list/ObjectListQuery.d.ts.map +1 -1
- package/build/types/observable/internal/objectset/ObjectSetQuery.d.ts.map +1 -1
- package/build/types/observable/internal/objectset/ObjectSetQueryOptions.d.ts +15 -0
- package/build/types/observable/internal/objectset/ObjectSetQueryOptions.d.ts.map +1 -1
- package/build/types/observable/internal/testUtils.d.ts +2 -2
- package/build/types/observable/internal/testUtils.d.ts.map +1 -1
- package/build/types/public/internal-node.d.ts +2 -0
- package/build/types/public/internal-node.d.ts.map +1 -0
- package/build/types/public/unstable-do-not-use.d.ts +1 -1
- package/build/types/public/unstable-do-not-use.d.ts.map +1 -1
- package/build/types/queries/applyQuery.d.ts.map +1 -1
- package/build/types/queries/types.d.ts +1 -1
- package/build/types/queries/types.d.ts.map +1 -1
- package/internal-node.d.ts +17 -0
- package/package.json +22 -13
- package/build/browser/object/formatting/applyPropertyFormatter.js +0 -58
- package/build/browser/object/formatting/applyPropertyFormatter.js.map +0 -1
- package/build/browser/object/formatting/applyPropertyFormatter.test.js +0 -726
- package/build/browser/object/formatting/applyPropertyFormatter.test.js.map +0 -1
- package/build/browser/object/formatting/formatBoolean.js.map +0 -1
- package/build/browser/object/formatting/formatDateTime.js +0 -158
- package/build/browser/object/formatting/formatDateTime.js.map +0 -1
- package/build/browser/object/formatting/formatNumber.js +0 -242
- package/build/browser/object/formatting/formatNumber.js.map +0 -1
- package/build/browser/object/formatting/propertyFormattingUtils.js.map +0 -1
- package/build/cjs/chunk-HJV24UL2.cjs.map +0 -1
- package/build/cjs/chunk-PCNVSZXT.cjs.map +0 -1
- package/build/cjs/chunk-Q7SFCCGT.cjs +0 -11
- package/build/cjs/chunk-Q7SFCCGT.cjs.map +0 -1
- package/build/cjs/delay-QK4T7RVX.cjs.map +0 -1
- package/build/esm/object/formatting/applyPropertyFormatter.js +0 -58
- package/build/esm/object/formatting/applyPropertyFormatter.js.map +0 -1
- package/build/esm/object/formatting/applyPropertyFormatter.test.js +0 -726
- package/build/esm/object/formatting/applyPropertyFormatter.test.js.map +0 -1
- package/build/esm/object/formatting/formatBoolean.js.map +0 -1
- package/build/esm/object/formatting/formatDateTime.js +0 -158
- package/build/esm/object/formatting/formatDateTime.js.map +0 -1
- package/build/esm/object/formatting/formatNumber.js +0 -242
- package/build/esm/object/formatting/formatNumber.js.map +0 -1
- package/build/esm/object/formatting/propertyFormattingUtils.js.map +0 -1
- package/build/types/object/formatting/applyPropertyFormatter.d.ts +0 -18
- package/build/types/object/formatting/applyPropertyFormatter.d.ts.map +0 -1
- package/build/types/object/formatting/applyPropertyFormatter.test.d.ts.map +0 -1
- package/build/types/object/formatting/formatBoolean.d.ts +0 -5
- package/build/types/object/formatting/formatBoolean.d.ts.map +0 -1
- package/build/types/object/formatting/formatDateTime.d.ts +0 -6
- package/build/types/object/formatting/formatDateTime.d.ts.map +0 -1
- package/build/types/object/formatting/formatNumber.d.ts +0 -15
- package/build/types/object/formatting/formatNumber.d.ts.map +0 -1
- package/build/types/object/formatting/propertyFormattingUtils.d.ts +0 -10
- package/build/types/object/formatting/propertyFormattingUtils.d.ts.map +0 -1
- /package/build/types/{object/formatting/applyPropertyFormatter.test.d.ts → observable/internal/list/ListQuery.test.d.ts} +0 -0
|
@@ -1,726 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright 2025 Palantir Technologies, Inc. All rights reserved.
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
|
18
|
-
import { InterfaceDefinitions } from "../../ontology/OntologyProvider.js";
|
|
19
|
-
import { createOsdkObject } from "../convertWireToOsdkObjects/createOsdkObject.js";
|
|
20
|
-
describe("getFormattedValue", () => {
|
|
21
|
-
const mockClient = {};
|
|
22
|
-
const EN_US = {
|
|
23
|
-
locale: "en-US"
|
|
24
|
-
};
|
|
25
|
-
const DE_DE = {
|
|
26
|
-
locale: "de-DE"
|
|
27
|
-
};
|
|
28
|
-
const FR_FR = {
|
|
29
|
-
locale: "fr-FR"
|
|
30
|
-
};
|
|
31
|
-
const EN_US_TOKYO = {
|
|
32
|
-
locale: "en-US",
|
|
33
|
-
timezoneId: "Asia/Tokyo"
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
// Single object definition with properties for testing
|
|
37
|
-
const OBJECT_DEF = {
|
|
38
|
-
apiName: "TestObject",
|
|
39
|
-
type: "object",
|
|
40
|
-
primaryKeyApiName: "id",
|
|
41
|
-
titleProperty: "id",
|
|
42
|
-
rid: "ri.test.object",
|
|
43
|
-
displayName: "Test Object",
|
|
44
|
-
description: "A test object",
|
|
45
|
-
primaryKeyType: "string",
|
|
46
|
-
icon: undefined,
|
|
47
|
-
visibility: "NORMAL",
|
|
48
|
-
pluralDisplayName: "Test Objects",
|
|
49
|
-
status: "ACTIVE",
|
|
50
|
-
interfaceMap: {},
|
|
51
|
-
inverseInterfaceMap: {},
|
|
52
|
-
links: {},
|
|
53
|
-
implements: [],
|
|
54
|
-
[InterfaceDefinitions]: {},
|
|
55
|
-
properties: {
|
|
56
|
-
id: {
|
|
57
|
-
type: "string",
|
|
58
|
-
nullable: false,
|
|
59
|
-
multiplicity: false
|
|
60
|
-
},
|
|
61
|
-
stringPropertyNoFormatting: {
|
|
62
|
-
type: "string",
|
|
63
|
-
nullable: true,
|
|
64
|
-
multiplicity: false
|
|
65
|
-
},
|
|
66
|
-
booleanPropertyCustomLabels: {
|
|
67
|
-
type: "boolean",
|
|
68
|
-
nullable: false,
|
|
69
|
-
multiplicity: false,
|
|
70
|
-
valueFormatting: {
|
|
71
|
-
type: "boolean",
|
|
72
|
-
valueIfTrue: "Active",
|
|
73
|
-
valueIfFalse: "Inactive"
|
|
74
|
-
}
|
|
75
|
-
},
|
|
76
|
-
nullableBooleanProperty: {
|
|
77
|
-
type: "boolean",
|
|
78
|
-
nullable: true,
|
|
79
|
-
multiplicity: false,
|
|
80
|
-
valueFormatting: {
|
|
81
|
-
type: "boolean",
|
|
82
|
-
valueIfTrue: "Yes",
|
|
83
|
-
valueIfFalse: "No"
|
|
84
|
-
}
|
|
85
|
-
},
|
|
86
|
-
priceStandard: {
|
|
87
|
-
type: "double",
|
|
88
|
-
nullable: false,
|
|
89
|
-
multiplicity: false,
|
|
90
|
-
valueFormatting: {
|
|
91
|
-
type: "number",
|
|
92
|
-
numberType: {
|
|
93
|
-
type: "standard",
|
|
94
|
-
baseFormatOptions: {
|
|
95
|
-
minimumFractionDigits: 2,
|
|
96
|
-
maximumFractionDigits: 2,
|
|
97
|
-
useGrouping: true
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
},
|
|
102
|
-
priceWithParenthesis: {
|
|
103
|
-
type: "double",
|
|
104
|
-
nullable: false,
|
|
105
|
-
multiplicity: false,
|
|
106
|
-
valueFormatting: {
|
|
107
|
-
type: "number",
|
|
108
|
-
numberType: {
|
|
109
|
-
type: "standard",
|
|
110
|
-
baseFormatOptions: {
|
|
111
|
-
minimumFractionDigits: 2,
|
|
112
|
-
maximumFractionDigits: 2,
|
|
113
|
-
convertNegativeToParenthesis: true
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
},
|
|
118
|
-
amount: {
|
|
119
|
-
type: "double",
|
|
120
|
-
nullable: false,
|
|
121
|
-
multiplicity: false,
|
|
122
|
-
valueFormatting: {
|
|
123
|
-
type: "number",
|
|
124
|
-
numberType: {
|
|
125
|
-
type: "currency",
|
|
126
|
-
style: "STANDARD",
|
|
127
|
-
currencyCode: {
|
|
128
|
-
type: "constant",
|
|
129
|
-
value: "USD"
|
|
130
|
-
},
|
|
131
|
-
baseFormatOptions: {
|
|
132
|
-
minimumFractionDigits: 2,
|
|
133
|
-
maximumFractionDigits: 2
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
},
|
|
138
|
-
dynamicCurrencyAmount: {
|
|
139
|
-
type: "double",
|
|
140
|
-
nullable: false,
|
|
141
|
-
multiplicity: false,
|
|
142
|
-
valueFormatting: {
|
|
143
|
-
type: "number",
|
|
144
|
-
numberType: {
|
|
145
|
-
type: "currency",
|
|
146
|
-
style: "COMPACT",
|
|
147
|
-
currencyCode: {
|
|
148
|
-
type: "propertyType",
|
|
149
|
-
propertyApiName: "currencyCode"
|
|
150
|
-
},
|
|
151
|
-
baseFormatOptions: {
|
|
152
|
-
minimumFractionDigits: 2,
|
|
153
|
-
maximumFractionDigits: 2
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
},
|
|
158
|
-
distance: {
|
|
159
|
-
type: "double",
|
|
160
|
-
nullable: false,
|
|
161
|
-
multiplicity: false,
|
|
162
|
-
valueFormatting: {
|
|
163
|
-
type: "number",
|
|
164
|
-
numberType: {
|
|
165
|
-
type: "standardUnit",
|
|
166
|
-
unit: {
|
|
167
|
-
type: "constant",
|
|
168
|
-
value: "kilometer"
|
|
169
|
-
},
|
|
170
|
-
baseFormatOptions: {
|
|
171
|
-
minimumFractionDigits: 1,
|
|
172
|
-
maximumFractionDigits: 1
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
},
|
|
177
|
-
customQuantity: {
|
|
178
|
-
type: "double",
|
|
179
|
-
nullable: false,
|
|
180
|
-
multiplicity: false,
|
|
181
|
-
valueFormatting: {
|
|
182
|
-
type: "number",
|
|
183
|
-
numberType: {
|
|
184
|
-
type: "customUnit",
|
|
185
|
-
unit: {
|
|
186
|
-
type: "constant",
|
|
187
|
-
value: "widgets"
|
|
188
|
-
},
|
|
189
|
-
baseFormatOptions: {
|
|
190
|
-
minimumFractionDigits: 0,
|
|
191
|
-
maximumFractionDigits: 0
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
},
|
|
196
|
-
prefixedNumber: {
|
|
197
|
-
type: "double",
|
|
198
|
-
nullable: false,
|
|
199
|
-
multiplicity: false,
|
|
200
|
-
valueFormatting: {
|
|
201
|
-
type: "number",
|
|
202
|
-
numberType: {
|
|
203
|
-
type: "affix",
|
|
204
|
-
affix: {
|
|
205
|
-
prefix: {
|
|
206
|
-
type: "constant",
|
|
207
|
-
value: "ID-"
|
|
208
|
-
},
|
|
209
|
-
postfix: {
|
|
210
|
-
type: "constant",
|
|
211
|
-
value: "-END"
|
|
212
|
-
}
|
|
213
|
-
},
|
|
214
|
-
baseFormatOptions: {
|
|
215
|
-
minimumIntegerDigits: 4,
|
|
216
|
-
useGrouping: false
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
},
|
|
221
|
-
largeNumber: {
|
|
222
|
-
type: "double",
|
|
223
|
-
nullable: false,
|
|
224
|
-
multiplicity: false,
|
|
225
|
-
valueFormatting: {
|
|
226
|
-
type: "number",
|
|
227
|
-
numberType: {
|
|
228
|
-
type: "scale",
|
|
229
|
-
scaleType: "MILLIONS",
|
|
230
|
-
baseFormatOptions: {
|
|
231
|
-
minimumFractionDigits: 2,
|
|
232
|
-
maximumFractionDigits: 2
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
},
|
|
237
|
-
thousandsNumber: {
|
|
238
|
-
type: "double",
|
|
239
|
-
nullable: false,
|
|
240
|
-
multiplicity: false,
|
|
241
|
-
valueFormatting: {
|
|
242
|
-
type: "number",
|
|
243
|
-
numberType: {
|
|
244
|
-
type: "scale",
|
|
245
|
-
scaleType: "THOUSANDS",
|
|
246
|
-
baseFormatOptions: {
|
|
247
|
-
minimumFractionDigits: 1,
|
|
248
|
-
maximumFractionDigits: 1
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
},
|
|
253
|
-
billionsNumber: {
|
|
254
|
-
type: "double",
|
|
255
|
-
nullable: false,
|
|
256
|
-
multiplicity: false,
|
|
257
|
-
valueFormatting: {
|
|
258
|
-
type: "number",
|
|
259
|
-
numberType: {
|
|
260
|
-
type: "scale",
|
|
261
|
-
scaleType: "BILLIONS",
|
|
262
|
-
baseFormatOptions: {
|
|
263
|
-
minimumFractionDigits: 2,
|
|
264
|
-
maximumFractionDigits: 2
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
},
|
|
269
|
-
percentage: {
|
|
270
|
-
type: "double",
|
|
271
|
-
nullable: false,
|
|
272
|
-
multiplicity: false,
|
|
273
|
-
valueFormatting: {
|
|
274
|
-
type: "number",
|
|
275
|
-
numberType: {
|
|
276
|
-
type: "ratio",
|
|
277
|
-
ratioType: "PERCENTAGE",
|
|
278
|
-
baseFormatOptions: {
|
|
279
|
-
minimumFractionDigits: 1,
|
|
280
|
-
maximumFractionDigits: 1
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
},
|
|
285
|
-
basisPoints: {
|
|
286
|
-
type: "double",
|
|
287
|
-
nullable: false,
|
|
288
|
-
multiplicity: false,
|
|
289
|
-
valueFormatting: {
|
|
290
|
-
type: "number",
|
|
291
|
-
numberType: {
|
|
292
|
-
type: "ratio",
|
|
293
|
-
ratioType: "BASIS_POINTS",
|
|
294
|
-
baseFormatOptions: {
|
|
295
|
-
minimumFractionDigits: 0,
|
|
296
|
-
maximumFractionDigits: 0
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
},
|
|
301
|
-
currencyCode: {
|
|
302
|
-
type: "string",
|
|
303
|
-
nullable: true,
|
|
304
|
-
multiplicity: false
|
|
305
|
-
},
|
|
306
|
-
createdDate: {
|
|
307
|
-
type: "datetime",
|
|
308
|
-
nullable: false,
|
|
309
|
-
multiplicity: false,
|
|
310
|
-
valueFormatting: {
|
|
311
|
-
type: "date",
|
|
312
|
-
format: {
|
|
313
|
-
type: "localizedFormat",
|
|
314
|
-
format: "DATE_FORMAT_DATE"
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
},
|
|
318
|
-
createdDateTime: {
|
|
319
|
-
type: "datetime",
|
|
320
|
-
nullable: false,
|
|
321
|
-
multiplicity: false,
|
|
322
|
-
valueFormatting: {
|
|
323
|
-
type: "timestamp",
|
|
324
|
-
format: {
|
|
325
|
-
type: "localizedFormat",
|
|
326
|
-
format: "DATE_FORMAT_DATE_TIME"
|
|
327
|
-
},
|
|
328
|
-
displayTimezone: {
|
|
329
|
-
type: "static",
|
|
330
|
-
zoneId: {
|
|
331
|
-
type: "constant",
|
|
332
|
-
value: "America/New_York"
|
|
333
|
-
}
|
|
334
|
-
}
|
|
335
|
-
}
|
|
336
|
-
},
|
|
337
|
-
createdDateTimeShort: {
|
|
338
|
-
type: "datetime",
|
|
339
|
-
nullable: false,
|
|
340
|
-
multiplicity: false,
|
|
341
|
-
valueFormatting: {
|
|
342
|
-
type: "timestamp",
|
|
343
|
-
format: {
|
|
344
|
-
type: "localizedFormat",
|
|
345
|
-
format: "DATE_FORMAT_DATE_TIME_SHORT"
|
|
346
|
-
},
|
|
347
|
-
displayTimezone: {
|
|
348
|
-
type: "static",
|
|
349
|
-
zoneId: {
|
|
350
|
-
type: "constant",
|
|
351
|
-
value: "America/Los_Angeles"
|
|
352
|
-
}
|
|
353
|
-
}
|
|
354
|
-
}
|
|
355
|
-
},
|
|
356
|
-
createdTime: {
|
|
357
|
-
type: "datetime",
|
|
358
|
-
nullable: false,
|
|
359
|
-
multiplicity: false,
|
|
360
|
-
valueFormatting: {
|
|
361
|
-
type: "timestamp",
|
|
362
|
-
format: {
|
|
363
|
-
type: "localizedFormat",
|
|
364
|
-
format: "DATE_FORMAT_TIME"
|
|
365
|
-
},
|
|
366
|
-
displayTimezone: {
|
|
367
|
-
type: "static",
|
|
368
|
-
zoneId: {
|
|
369
|
-
type: "constant",
|
|
370
|
-
value: "UTC"
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
|
-
}
|
|
374
|
-
},
|
|
375
|
-
yearMonth: {
|
|
376
|
-
type: "datetime",
|
|
377
|
-
nullable: false,
|
|
378
|
-
multiplicity: false,
|
|
379
|
-
valueFormatting: {
|
|
380
|
-
type: "date",
|
|
381
|
-
format: {
|
|
382
|
-
type: "localizedFormat",
|
|
383
|
-
format: "DATE_FORMAT_YEAR_AND_MONTH"
|
|
384
|
-
}
|
|
385
|
-
}
|
|
386
|
-
},
|
|
387
|
-
isoInstant: {
|
|
388
|
-
type: "datetime",
|
|
389
|
-
nullable: false,
|
|
390
|
-
multiplicity: false,
|
|
391
|
-
valueFormatting: {
|
|
392
|
-
type: "timestamp",
|
|
393
|
-
format: {
|
|
394
|
-
type: "localizedFormat",
|
|
395
|
-
format: "DATE_FORMAT_ISO_INSTANT"
|
|
396
|
-
},
|
|
397
|
-
displayTimezone: {
|
|
398
|
-
type: "user"
|
|
399
|
-
}
|
|
400
|
-
}
|
|
401
|
-
},
|
|
402
|
-
timestampWithUserTimezone: {
|
|
403
|
-
type: "datetime",
|
|
404
|
-
nullable: false,
|
|
405
|
-
multiplicity: false,
|
|
406
|
-
valueFormatting: {
|
|
407
|
-
type: "timestamp",
|
|
408
|
-
format: {
|
|
409
|
-
type: "localizedFormat",
|
|
410
|
-
format: "DATE_FORMAT_DATE_TIME"
|
|
411
|
-
},
|
|
412
|
-
displayTimezone: {
|
|
413
|
-
type: "user"
|
|
414
|
-
}
|
|
415
|
-
}
|
|
416
|
-
},
|
|
417
|
-
timestampWithDynamicTimezone: {
|
|
418
|
-
type: "datetime",
|
|
419
|
-
nullable: false,
|
|
420
|
-
multiplicity: false,
|
|
421
|
-
valueFormatting: {
|
|
422
|
-
type: "timestamp",
|
|
423
|
-
format: {
|
|
424
|
-
type: "localizedFormat",
|
|
425
|
-
format: "DATE_FORMAT_DATE_TIME"
|
|
426
|
-
},
|
|
427
|
-
displayTimezone: {
|
|
428
|
-
type: "static",
|
|
429
|
-
zoneId: {
|
|
430
|
-
type: "propertyType",
|
|
431
|
-
propertyApiName: "timezoneId"
|
|
432
|
-
}
|
|
433
|
-
}
|
|
434
|
-
}
|
|
435
|
-
},
|
|
436
|
-
timezoneId: {
|
|
437
|
-
type: "string",
|
|
438
|
-
nullable: true,
|
|
439
|
-
multiplicity: false
|
|
440
|
-
},
|
|
441
|
-
relativeDateTime: {
|
|
442
|
-
type: "datetime",
|
|
443
|
-
nullable: false,
|
|
444
|
-
multiplicity: false,
|
|
445
|
-
valueFormatting: {
|
|
446
|
-
type: "timestamp",
|
|
447
|
-
format: {
|
|
448
|
-
type: "localizedFormat",
|
|
449
|
-
format: "DATE_FORMAT_RELATIVE_TO_NOW"
|
|
450
|
-
},
|
|
451
|
-
displayTimezone: {
|
|
452
|
-
type: "user"
|
|
453
|
-
}
|
|
454
|
-
}
|
|
455
|
-
}
|
|
456
|
-
}
|
|
457
|
-
};
|
|
458
|
-
|
|
459
|
-
// Default object data with properties populated
|
|
460
|
-
const DEFAULT_OBJECT_DATA = {
|
|
461
|
-
$apiName: "TestObject",
|
|
462
|
-
$primaryKey: "test-123",
|
|
463
|
-
$title: "Test Object",
|
|
464
|
-
$objectType: "TestObject",
|
|
465
|
-
id: "test-123",
|
|
466
|
-
stringPropertyNoFormatting: "Plain text",
|
|
467
|
-
booleanPropertyCustomLabels: true,
|
|
468
|
-
nullableBooleanProperty: undefined,
|
|
469
|
-
priceStandard: 1234.56,
|
|
470
|
-
priceWithParenthesis: -1234.56,
|
|
471
|
-
amount: 1234.56,
|
|
472
|
-
dynamicCurrencyAmount: 1234.56,
|
|
473
|
-
distance: 42.7,
|
|
474
|
-
customQuantity: 150,
|
|
475
|
-
prefixedNumber: 42,
|
|
476
|
-
largeNumber: 5000000,
|
|
477
|
-
thousandsNumber: 5000,
|
|
478
|
-
billionsNumber: 3000000000,
|
|
479
|
-
percentage: 0.125,
|
|
480
|
-
basisPoints: 0.125,
|
|
481
|
-
currencyCode: "EUR",
|
|
482
|
-
createdDate: "2025-01-15T14:30:00.000Z",
|
|
483
|
-
createdDateTime: "2025-01-15T14:30:00.000Z",
|
|
484
|
-
createdDateTimeShort: "2025-01-15T14:30:00.000Z",
|
|
485
|
-
createdTime: "2025-01-15T14:30:00.000Z",
|
|
486
|
-
yearMonth: "2025-01-15T00:00:00.000Z",
|
|
487
|
-
isoInstant: "2025-01-15T14:30:00.000Z",
|
|
488
|
-
timestampWithUserTimezone: "2025-01-15T14:30:00.000Z",
|
|
489
|
-
timestampWithDynamicTimezone: "2025-01-15T14:30:00.000Z",
|
|
490
|
-
relativeDateTime: "2025-01-15T14:30:00.000Z",
|
|
491
|
-
timezoneId: "Europe/London"
|
|
492
|
-
};
|
|
493
|
-
|
|
494
|
-
// Helper to create an OSDK object with optional data overrides
|
|
495
|
-
function getObject(dataOverrides) {
|
|
496
|
-
const objectData = {
|
|
497
|
-
...DEFAULT_OBJECT_DATA,
|
|
498
|
-
...dataOverrides
|
|
499
|
-
};
|
|
500
|
-
return createOsdkObject(mockClient, OBJECT_DEF, objectData);
|
|
501
|
-
}
|
|
502
|
-
it("formats boolean true with custom label", () => {
|
|
503
|
-
const obj = getObject();
|
|
504
|
-
const formatted = obj.$__EXPERIMENTAL__NOT_SUPPORTED_YET__getFormattedValue("booleanPropertyCustomLabels");
|
|
505
|
-
expect(formatted).toBe("Active");
|
|
506
|
-
});
|
|
507
|
-
it("formats boolean false with custom label", () => {
|
|
508
|
-
const obj = getObject({
|
|
509
|
-
booleanPropertyCustomLabels: false
|
|
510
|
-
});
|
|
511
|
-
const formatted = obj.$__EXPERIMENTAL__NOT_SUPPORTED_YET__getFormattedValue("booleanPropertyCustomLabels");
|
|
512
|
-
expect(formatted).toBe("Inactive");
|
|
513
|
-
});
|
|
514
|
-
it("returns undefined for property without formatting rules", () => {
|
|
515
|
-
const obj = getObject();
|
|
516
|
-
const formatted = obj.$__EXPERIMENTAL__NOT_SUPPORTED_YET__getFormattedValue("stringPropertyNoFormatting");
|
|
517
|
-
expect(formatted).toBeUndefined();
|
|
518
|
-
});
|
|
519
|
-
it("returns undefined for undefined values", () => {
|
|
520
|
-
const obj = getObject();
|
|
521
|
-
const formatted = obj.$__EXPERIMENTAL__NOT_SUPPORTED_YET__getFormattedValue("nullableBooleanProperty");
|
|
522
|
-
expect(formatted).toBeUndefined();
|
|
523
|
-
});
|
|
524
|
-
describe("Number formatting", () => {
|
|
525
|
-
it("formats standard number with grouping and decimals", () => {
|
|
526
|
-
const obj = getObject();
|
|
527
|
-
expect(obj.$__EXPERIMENTAL__NOT_SUPPORTED_YET__getFormattedValue("priceStandard", EN_US)).toBe("1,234.56");
|
|
528
|
-
});
|
|
529
|
-
it("converts negative to parenthesis when configured", () => {
|
|
530
|
-
const obj = getObject();
|
|
531
|
-
expect(obj.$__EXPERIMENTAL__NOT_SUPPORTED_YET__getFormattedValue("priceWithParenthesis", EN_US)).toBe("(1,234.56)");
|
|
532
|
-
});
|
|
533
|
-
it("formats currency with constant currency code", () => {
|
|
534
|
-
const obj = getObject();
|
|
535
|
-
expect(obj.$__EXPERIMENTAL__NOT_SUPPORTED_YET__getFormattedValue("amount", EN_US)).toBe("$1,234.56");
|
|
536
|
-
});
|
|
537
|
-
it("formats currency with dynamic currency code from property reference", () => {
|
|
538
|
-
const obj = getObject({
|
|
539
|
-
currencyCode: "EUR"
|
|
540
|
-
});
|
|
541
|
-
expect(obj.$__EXPERIMENTAL__NOT_SUPPORTED_YET__getFormattedValue("dynamicCurrencyAmount", EN_US)).toBe("€1,234.56");
|
|
542
|
-
});
|
|
543
|
-
it("falls back to standard formatting when currency code is null", () => {
|
|
544
|
-
const obj = getObject({
|
|
545
|
-
currencyCode: undefined
|
|
546
|
-
});
|
|
547
|
-
expect(obj.$__EXPERIMENTAL__NOT_SUPPORTED_YET__getFormattedValue("dynamicCurrencyAmount", EN_US)).toBe("1,234.56");
|
|
548
|
-
});
|
|
549
|
-
it("formats with standard unit", () => {
|
|
550
|
-
const obj = getObject();
|
|
551
|
-
expect(obj.$__EXPERIMENTAL__NOT_SUPPORTED_YET__getFormattedValue("distance", EN_US)).toBe("42.7 km");
|
|
552
|
-
});
|
|
553
|
-
it("formats with custom unit", () => {
|
|
554
|
-
const obj = getObject();
|
|
555
|
-
expect(obj.$__EXPERIMENTAL__NOT_SUPPORTED_YET__getFormattedValue("customQuantity", EN_US)).toBe("150 widgets");
|
|
556
|
-
});
|
|
557
|
-
it("formats with prefix and suffix", () => {
|
|
558
|
-
const obj = getObject();
|
|
559
|
-
expect(obj.$__EXPERIMENTAL__NOT_SUPPORTED_YET__getFormattedValue("prefixedNumber", EN_US)).toBe("ID-0042-END");
|
|
560
|
-
});
|
|
561
|
-
it("formats scaled millions in en-US", () => {
|
|
562
|
-
const obj = getObject();
|
|
563
|
-
expect(obj.$__EXPERIMENTAL__NOT_SUPPORTED_YET__getFormattedValue("largeNumber", EN_US)).toBe("5.00M");
|
|
564
|
-
});
|
|
565
|
-
it("formats scaled millions in de-DE", () => {
|
|
566
|
-
const obj = getObject();
|
|
567
|
-
expect(obj.$__EXPERIMENTAL__NOT_SUPPORTED_YET__getFormattedValue("largeNumber", DE_DE)).toBe("5,00Mio.");
|
|
568
|
-
});
|
|
569
|
-
it("formats scaled thousands in en-US", () => {
|
|
570
|
-
const obj = getObject();
|
|
571
|
-
expect(obj.$__EXPERIMENTAL__NOT_SUPPORTED_YET__getFormattedValue("thousandsNumber", EN_US)).toBe("5.0K");
|
|
572
|
-
});
|
|
573
|
-
it("formats scaled billions in fr-FR", () => {
|
|
574
|
-
const obj = getObject();
|
|
575
|
-
expect(obj.$__EXPERIMENTAL__NOT_SUPPORTED_YET__getFormattedValue("billionsNumber", FR_FR)).toBe("3,00Md");
|
|
576
|
-
});
|
|
577
|
-
it("formats percentage", () => {
|
|
578
|
-
const obj = getObject();
|
|
579
|
-
expect(obj.$__EXPERIMENTAL__NOT_SUPPORTED_YET__getFormattedValue("percentage", EN_US)).toBe("12.5%");
|
|
580
|
-
});
|
|
581
|
-
it("formats basis points", () => {
|
|
582
|
-
const obj = getObject();
|
|
583
|
-
expect(obj.$__EXPERIMENTAL__NOT_SUPPORTED_YET__getFormattedValue("basisPoints", EN_US)).toBe("1,250 bps");
|
|
584
|
-
});
|
|
585
|
-
});
|
|
586
|
-
describe("Date and time formatting", () => {
|
|
587
|
-
it("formats date without timezone", () => {
|
|
588
|
-
const obj = getObject();
|
|
589
|
-
const formatted = obj.$__EXPERIMENTAL__NOT_SUPPORTED_YET__getFormattedValue("createdDate", EN_US);
|
|
590
|
-
expect(formatted).toBe("Wed, Jan 15, 2025");
|
|
591
|
-
});
|
|
592
|
-
it("formats date in different locale", () => {
|
|
593
|
-
const obj = getObject();
|
|
594
|
-
const formatted = obj.$__EXPERIMENTAL__NOT_SUPPORTED_YET__getFormattedValue("createdDate", DE_DE);
|
|
595
|
-
expect(formatted).toBe("Mi., 15. Jan. 2025");
|
|
596
|
-
});
|
|
597
|
-
it("formats timestamp with static timezone (America/New_York)", () => {
|
|
598
|
-
const obj = getObject();
|
|
599
|
-
const formatted = obj.$__EXPERIMENTAL__NOT_SUPPORTED_YET__getFormattedValue("createdDateTime", EN_US);
|
|
600
|
-
|
|
601
|
-
// Should show time in EST (UTC-5), so 14:30 UTC = 9:30 AM EST
|
|
602
|
-
expect(formatted).toBe("Wed, Jan 15, 2025, 9:30:00 AM");
|
|
603
|
-
});
|
|
604
|
-
it("formats timestamp short with static timezone (America/Los_Angeles)", () => {
|
|
605
|
-
const obj = getObject();
|
|
606
|
-
const formatted = obj.$__EXPERIMENTAL__NOT_SUPPORTED_YET__getFormattedValue("createdDateTimeShort", EN_US);
|
|
607
|
-
|
|
608
|
-
// Should show time in PST (UTC-8), so 14:30 UTC = 6:30 AM PST
|
|
609
|
-
expect(formatted).toBe("Jan 15, 2025, 6:30 AM");
|
|
610
|
-
});
|
|
611
|
-
it("formats time only with UTC timezone", () => {
|
|
612
|
-
const obj = getObject();
|
|
613
|
-
const formatted = obj.$__EXPERIMENTAL__NOT_SUPPORTED_YET__getFormattedValue("createdTime", EN_US);
|
|
614
|
-
|
|
615
|
-
// Should show 14:30:00 in UTC as 2:30:00 PM
|
|
616
|
-
expect(formatted).toBe("2:30:00 PM");
|
|
617
|
-
});
|
|
618
|
-
it("formats year and month only", () => {
|
|
619
|
-
const obj = getObject();
|
|
620
|
-
const formatted = obj.$__EXPERIMENTAL__NOT_SUPPORTED_YET__getFormattedValue("yearMonth", EN_US);
|
|
621
|
-
expect(formatted).toBe("Jan 2025");
|
|
622
|
-
});
|
|
623
|
-
it("formats ISO instant", () => {
|
|
624
|
-
const obj = getObject();
|
|
625
|
-
const formatted = obj.$__EXPERIMENTAL__NOT_SUPPORTED_YET__getFormattedValue("isoInstant", EN_US);
|
|
626
|
-
expect(formatted).toBe("2025-01-15T14:30:00.000Z");
|
|
627
|
-
});
|
|
628
|
-
it("formats timestamp with user timezone (no override)", () => {
|
|
629
|
-
const obj = getObject();
|
|
630
|
-
const formatted = obj.$__EXPERIMENTAL__NOT_SUPPORTED_YET__getFormattedValue("timestampWithUserTimezone", EN_US);
|
|
631
|
-
|
|
632
|
-
// Without an override, should use the browser's default timezone
|
|
633
|
-
// The exact output depends on the system timezone, so we verify it's a non-empty string
|
|
634
|
-
expect(formatted).toBeTruthy();
|
|
635
|
-
expect(typeof formatted).toBe("string");
|
|
636
|
-
});
|
|
637
|
-
it("formats timestamp with user timezone override", () => {
|
|
638
|
-
const obj = getObject();
|
|
639
|
-
const formatted = obj.$__EXPERIMENTAL__NOT_SUPPORTED_YET__getFormattedValue("timestampWithUserTimezone", EN_US_TOKYO);
|
|
640
|
-
|
|
641
|
-
// With Asia/Tokyo override (UTC+9), 14:30 UTC = 23:30 JST
|
|
642
|
-
expect(formatted).toBe("Wed, Jan 15, 2025, 11:30:00 PM");
|
|
643
|
-
});
|
|
644
|
-
it("formats timestamp with dynamic timezone from property", () => {
|
|
645
|
-
const obj = getObject({
|
|
646
|
-
timezoneId: "Europe/London"
|
|
647
|
-
});
|
|
648
|
-
const formatted = obj.$__EXPERIMENTAL__NOT_SUPPORTED_YET__getFormattedValue("timestampWithDynamicTimezone", EN_US);
|
|
649
|
-
|
|
650
|
-
// Europe/London in January is GMT (UTC+0), so same as UTC: 14:30 = 2:30 PM
|
|
651
|
-
expect(formatted).toBe("Wed, Jan 15, 2025, 2:30:00 PM");
|
|
652
|
-
});
|
|
653
|
-
it("formats timestamp with dynamic timezone from property (different timezone)", () => {
|
|
654
|
-
const obj = getObject({
|
|
655
|
-
timezoneId: "Australia/Sydney"
|
|
656
|
-
});
|
|
657
|
-
const formatted = obj.$__EXPERIMENTAL__NOT_SUPPORTED_YET__getFormattedValue("timestampWithDynamicTimezone", EN_US);
|
|
658
|
-
|
|
659
|
-
// Australia/Sydney in January is UTC+11, so 14:30 UTC = 1:30 AM next day
|
|
660
|
-
expect(formatted).toBe("Thu, Jan 16, 2025, 1:30:00 AM");
|
|
661
|
-
});
|
|
662
|
-
it("formats timestamp when dynamic timezone property is null", () => {
|
|
663
|
-
const obj = getObject({
|
|
664
|
-
timezoneId: undefined
|
|
665
|
-
});
|
|
666
|
-
const formatted = obj.$__EXPERIMENTAL__NOT_SUPPORTED_YET__getFormattedValue("timestampWithDynamicTimezone", EN_US);
|
|
667
|
-
|
|
668
|
-
// Should fall back to no timezone (browser default)
|
|
669
|
-
// The exact output depends on the system timezone, so we verify it's a non-empty string
|
|
670
|
-
expect(formatted).toBeTruthy();
|
|
671
|
-
expect(typeof formatted).toBe("string");
|
|
672
|
-
});
|
|
673
|
-
it("handles invalid date strings gracefully", () => {
|
|
674
|
-
const obj = getObject({
|
|
675
|
-
createdDate: "invalid-date"
|
|
676
|
-
});
|
|
677
|
-
const formatted = obj.$__EXPERIMENTAL__NOT_SUPPORTED_YET__getFormattedValue("createdDate", EN_US);
|
|
678
|
-
expect(formatted).toBeUndefined();
|
|
679
|
-
});
|
|
680
|
-
});
|
|
681
|
-
describe("Relative time formatting", () => {
|
|
682
|
-
beforeEach(() => {
|
|
683
|
-
// Mock current time to January 15, 2025, 12:00:00 UTC since we're checking for relative time.
|
|
684
|
-
vi.setSystemTime(new Date("2025-01-15T12:00:00.000Z"));
|
|
685
|
-
});
|
|
686
|
-
afterEach(() => {
|
|
687
|
-
vi.useRealTimers();
|
|
688
|
-
});
|
|
689
|
-
it("formats time 45 seconds ago", () => {
|
|
690
|
-
const obj = getObject({
|
|
691
|
-
relativeDateTime: "2025-01-15T11:59:15.000Z"
|
|
692
|
-
});
|
|
693
|
-
const formatted = obj.$__EXPERIMENTAL__NOT_SUPPORTED_YET__getFormattedValue("relativeDateTime", EN_US);
|
|
694
|
-
expect(formatted).toBe("45 seconds ago");
|
|
695
|
-
});
|
|
696
|
-
it("formats time 30 minutes from now", () => {
|
|
697
|
-
const obj = getObject({
|
|
698
|
-
relativeDateTime: "2025-01-15T12:30:00.000Z"
|
|
699
|
-
});
|
|
700
|
-
const formatted = obj.$__EXPERIMENTAL__NOT_SUPPORTED_YET__getFormattedValue("relativeDateTime", EN_US);
|
|
701
|
-
expect(formatted).toBe("in 30 minutes");
|
|
702
|
-
});
|
|
703
|
-
it("formats time 3 hours ago", () => {
|
|
704
|
-
const obj = getObject({
|
|
705
|
-
relativeDateTime: "2025-01-15T09:00:00.000Z"
|
|
706
|
-
});
|
|
707
|
-
const formatted = obj.$__EXPERIMENTAL__NOT_SUPPORTED_YET__getFormattedValue("relativeDateTime", EN_US);
|
|
708
|
-
expect(formatted).toBe("3 hours ago");
|
|
709
|
-
});
|
|
710
|
-
it("formats now", () => {
|
|
711
|
-
const obj = getObject({
|
|
712
|
-
relativeDateTime: "2025-01-15T12:00:00.000Z"
|
|
713
|
-
});
|
|
714
|
-
const formatted = obj.$__EXPERIMENTAL__NOT_SUPPORTED_YET__getFormattedValue("relativeDateTime", EN_US);
|
|
715
|
-
expect(formatted).toBe("now");
|
|
716
|
-
});
|
|
717
|
-
it("falls back to absolute date formatting for times more than 1 day ago", () => {
|
|
718
|
-
const obj = getObject({
|
|
719
|
-
relativeDateTime: "2025-01-10T08:00:00.000Z"
|
|
720
|
-
});
|
|
721
|
-
const formatted = obj.$__EXPERIMENTAL__NOT_SUPPORTED_YET__getFormattedValue("relativeDateTime", EN_US_TOKYO);
|
|
722
|
-
expect(formatted).toBe("Fri, Jan 10, 2025, 5:00 PM");
|
|
723
|
-
});
|
|
724
|
-
});
|
|
725
|
-
});
|
|
726
|
-
//# sourceMappingURL=applyPropertyFormatter.test.js.map
|