Skip to content

Commit 958da50

Browse files
MSAL-Node Tests: Fixed file extensions on all imports & added MS license to all files (AzureAD#7454)
Addressed tech debt in the msal-node tests. 1. Added ".js" to all file names in imports 2. Added the MS license at the top of all files
1 parent c837638 commit 958da50

29 files changed

+204
-109
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "none",
3+
"comment": "Fixed file extentions on imports. Added MS license to all files. (#7454)",
4+
"packageName": "@azure/msal-node",
5+
"email": "rginsburg@microsoft.com",
6+
"dependentChangeType": "none"
7+
}

lib/msal-node/test/cache/Storage.spec.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/*
2+
* Copyright (c) Microsoft Corporation. All rights reserved.
3+
* Licensed under the MIT License.
4+
*/
5+
16
import {
27
LogLevel,
38
Logger,
@@ -12,15 +17,15 @@ import {
1217
import {
1318
JsonCache,
1419
InMemoryCache,
15-
} from "./../../src/cache/serializer/SerializerTypes";
16-
import { Deserializer } from "./../../src/cache/serializer/Deserializer";
17-
import { NodeStorage } from "../../src/cache/NodeStorage";
20+
} from "./../../src/cache/serializer/SerializerTypes.js";
21+
import { Deserializer } from "./../../src/cache/serializer/Deserializer.js";
22+
import { NodeStorage } from "../../src/cache/NodeStorage.js";
1823
import { version, name } from "../../package.json";
1924
import {
2025
DEFAULT_CRYPTO_IMPLEMENTATION,
2126
DEFAULT_OPENID_CONFIG_RESPONSE,
2227
TEST_CONSTANTS,
23-
} from "../utils/TestConstants";
28+
} from "../utils/TestConstants.js";
2429

2530
const cacheJson = require("./serializer/cache.json");
2631
const clientId = TEST_CONSTANTS.CLIENT_ID;

lib/msal-node/test/cache/TokenCache.spec.ts

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,26 @@
1+
/*
2+
* Copyright (c) Microsoft Corporation. All rights reserved.
3+
* Licensed under the MIT License.
4+
*/
5+
16
import {
27
LogLevel,
38
Logger,
49
TokenCacheContext,
510
ICachePlugin,
611
buildStaticAuthorityOptions,
712
} from "@azure/msal-common";
8-
import { NodeStorage } from "../../src/cache/NodeStorage";
9-
import { TokenCache } from "../../src/cache/TokenCache";
13+
import { NodeStorage } from "../../src/cache/NodeStorage.js";
14+
import { TokenCache } from "../../src/cache/TokenCache.js";
1015
import { existsSync, watch, promises, FSWatcher } from "fs";
1116
import { version, name } from "../../package.json";
1217
import {
1318
DEFAULT_CRYPTO_IMPLEMENTATION,
1419
ID_TOKEN_CLAIMS,
15-
} from "../utils/TestConstants";
16-
import { Deserializer } from "../../src/cache/serializer/Deserializer";
17-
import { JsonCache } from "../../src";
18-
import { MSALCommonModule } from "../utils/MockUtils";
20+
} from "../utils/TestConstants.js";
21+
import { Deserializer } from "../../src/cache/serializer/Deserializer.js";
22+
import { JsonCache } from "../../src/index.js";
23+
import { MSALCommonModule } from "../utils/MockUtils.js";
1924

2025
const msalCommon: MSALCommonModule = jest.requireActual(
2126
"@azure/msal-common/node"

lib/msal-node/test/cache/cacheConstants.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/*
2+
* Copyright (c) Microsoft Corporation. All rights reserved.
3+
* Licensed under the MIT License.
4+
*/
5+
16
import {
27
AccessTokenEntity,
38
IdTokenEntity,

lib/msal-node/test/cache/distributed/DistributedCachePlugin.spec.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/*
2+
* Copyright (c) Microsoft Corporation. All rights reserved.
3+
* Licensed under the MIT License.
4+
*/
5+
16
import { DistributedCachePlugin } from "../../../src/cache/distributed/DistributedCachePlugin.js";
27
import {
38
AccountEntity,

lib/msal-node/test/cache/serializer/Deserializer.spec.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
1+
/*
2+
* Copyright (c) Microsoft Corporation. All rights reserved.
3+
* Licensed under the MIT License.
4+
*/
5+
16
import {
27
JsonCache,
38
InMemoryCache,
4-
} from "../../../src/cache/serializer/SerializerTypes";
5-
import { Deserializer } from "../../../src/cache/serializer/Deserializer";
6-
import { MockCache } from "../cacheConstants";
9+
} from "../../../src/cache/serializer/SerializerTypes.js";
10+
import { Deserializer } from "../../../src/cache/serializer/Deserializer.js";
11+
import { MockCache } from "../cacheConstants.js";
712

813
const cacheJson = require("./cache.json");
914

lib/msal-node/test/cache/serializer/Serializer.spec.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
1+
/*
2+
* Copyright (c) Microsoft Corporation. All rights reserved.
3+
* Licensed under the MIT License.
4+
*/
5+
16
import {
27
JsonCache,
38
InMemoryCache,
4-
} from "../../../src/cache/serializer/SerializerTypes";
5-
import { Serializer } from "../../../src/cache/serializer/Serializer";
6-
import { Deserializer } from "../../../src/cache/serializer/Deserializer";
7-
import { MockCache } from "../cacheConstants";
9+
} from "../../../src/cache/serializer/SerializerTypes.js";
10+
import { Serializer } from "../../../src/cache/serializer/Serializer.js";
11+
import { Deserializer } from "../../../src/cache/serializer/Deserializer.js";
12+
import { MockCache } from "../cacheConstants.js";
813

914
const cachedJson = require("./cache.json");
1015

lib/msal-node/test/client/ClientAssertion.spec.ts

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
1-
import { ClientAssertion } from "../../src/client/ClientAssertion";
1+
/*
2+
* Copyright (c) Microsoft Corporation. All rights reserved.
3+
* Licensed under the MIT License.
4+
*/
5+
6+
import { ClientAssertion } from "../../src/client/ClientAssertion.js";
27
import {
38
DEFAULT_OPENID_CONFIG_RESPONSE,
49
TEST_CONSTANTS,
5-
} from "../utils/TestConstants";
6-
import { CryptoProvider } from "../../src/crypto/CryptoProvider";
7-
import { EncodingUtils } from "../../src/utils/EncodingUtils";
8-
import { JwtConstants } from "../../src/utils/Constants";
9-
import { getClientAssertionCallback } from "./ClientTestUtils";
10+
} from "../utils/TestConstants.js";
11+
import { CryptoProvider } from "../../src/crypto/CryptoProvider.js";
12+
import { EncodingUtils } from "../../src/utils/EncodingUtils.js";
13+
import { JwtConstants } from "../../src/utils/Constants.js";
14+
import { getClientAssertionCallback } from "./ClientTestUtils.js";
1015
import { getClientAssertion } from "@azure/msal-common";
1116
import jwt from "jsonwebtoken";
1217

lib/msal-node/test/client/ClientCredentialClient.spec.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@ import {
2222
CacheHelpers,
2323
GrantType,
2424
} from "@azure/msal-common";
25-
import { ClientCredentialClient, UsernamePasswordClient } from "../../src";
25+
import {
26+
ClientCredentialClient,
27+
UsernamePasswordClient,
28+
} from "../../src/index.js";
2629
import {
2730
AUTHENTICATION_RESULT_DEFAULT_SCOPES,
2831
CAE_CONSTANTS,
@@ -33,14 +36,14 @@ import {
3336
DSTS_OPENID_CONFIG_RESPONSE,
3437
TEST_CONFIG,
3538
TEST_TOKENS,
36-
} from "../test_kit/StringConstants";
39+
} from "../test_kit/StringConstants.js";
3740
import {
3841
checkMockedNetworkRequest,
3942
ClientTestUtils,
4043
getClientAssertionCallback,
4144
mockCrypto,
42-
} from "./ClientTestUtils";
43-
import { mockNetworkClient } from "../utils/MockNetworkClient";
45+
} from "./ClientTestUtils.js";
46+
import { mockNetworkClient } from "../utils/MockNetworkClient.js";
4447

4548
describe("ClientCredentialClient unit tests", () => {
4649
let createTokenRequestBodySpy: jest.SpyInstance;

lib/msal-node/test/client/ClientTestUtils.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ import {
4343
TEST_DATA_CLIENT_INFO,
4444
TEST_POP_VALUES,
4545
TEST_TOKENS,
46-
} from "../test_kit/StringConstants";
47-
import { Configuration } from "../../src/config/Configuration";
48-
import { TEST_CONSTANTS } from "../utils/TestConstants";
46+
} from "../test_kit/StringConstants.js";
47+
import { Configuration } from "../../src/config/Configuration.js";
48+
import { TEST_CONSTANTS } from "../utils/TestConstants.js";
4949

5050
const ACCOUNT_KEYS = "ACCOUNT_KEYS";
5151
const TOKEN_KEYS = "TOKEN_KEYS";

0 commit comments

Comments
 (0)