File tree Expand file tree Collapse file tree 2 files changed +13
-3
lines changed
packages/platform-core/src/usage-data Expand file tree Collapse file tree 2 files changed +13
-3
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ ---
Original file line number Diff line number Diff line change 1
1
import { afterEach , describe , test } from 'node:test' ;
2
2
import assert from 'node:assert' ;
3
- import { getUrl } from './get_usage_data_url ' ;
3
+ import url from 'node:url ' ;
4
4
5
5
void describe ( 'getUrl' , ( ) => {
6
6
afterEach ( ( ) => {
7
7
delete process . env . AMPLIFY_BACKEND_USAGE_TRACKING_ENDPOINT ;
8
+ delete require . cache [ require . resolve ( './get_usage_data_url' ) ] ;
8
9
} ) ;
9
10
void test ( 'that prod URL is returned when the env for beta URL is not set' , ( ) => {
10
- assert ( getUrl ( ) , 'https://api.cli.amplify.aws/v1.0/metrics' ) ;
11
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
12
+ const { getUrl } = require ( './get_usage_data_url' ) ;
13
+ assert . equal (
14
+ url . format ( getUrl ( ) ) ,
15
+ 'https://api.cli.amplify.aws/v1.0/metrics'
16
+ ) ;
11
17
} ) ;
12
18
13
19
void test ( 'that BETA URL is returned when the env for beta URL is set' , ( ) => {
14
20
process . env . AMPLIFY_BACKEND_USAGE_TRACKING_ENDPOINT =
15
21
'https://aws.amazon.com/amplify/' ;
16
- assert ( getUrl ( ) , 'https://aws.amazon.com/amplify/' ) ;
22
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
23
+ const { getUrl } = require ( './get_usage_data_url' ) ;
24
+ assert . equal ( url . format ( getUrl ( ) ) , 'https://aws.amazon.com/amplify/' ) ;
17
25
} ) ;
18
26
} ) ;
You can’t perform that action at this time.
0 commit comments