Skip to content

Commit c655e64

Browse files
committed
Fixed Test cases
1 parent e5743c3 commit c655e64

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

test/lib/HttpResponseHeadersUtils.test.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@ import { HttpResponseHeadersUtils } from '../../src/lib/httpResponseHeadersUtils
22

33
describe('HttpResponseHeadersUtils', () => {
44
describe('getClientQuotaLimit', () => {
5-
it('should return a valid TokenQuotaBucket when x-quota-client-limit header is present', () => {
5+
it('should return a valid TokenQuotaBucket when auth0-client-quota-limit header is present', () => {
66
const headers = {
7-
'x-quota-client-limit': 'per_hour;q=100;r=50;t=3600,per_day;q=1000;r=500;t=86400',
7+
'auth0-client-quota-limit': 'per_hour;q=100;r=50;t=3600,per_day;q=1000;r=500;t=86400',
88
};
99
const result = HttpResponseHeadersUtils.getClientQuotaLimit(headers);
1010
expect(result).toEqual({
11-
perHour: { quota: 100, remaining: 50, time: 3600 },
12-
perDay: { quota: 1000, remaining: 500, time: 86400 },
11+
perHour: { quota: 100, remaining: 50, resetAfter: 3600 },
12+
perDay: { quota: 1000, remaining: 500, resetAfter: 86400 },
1313
});
1414
});
1515

@@ -21,11 +21,11 @@ describe('HttpResponseHeadersUtils', () => {
2121
});
2222

2323
describe('getOrganizationQuotaLimit', () => {
24-
it('should return a valid TokenQuotaBucket when x-quota-Organization-limit header is present', () => {
25-
const headers = { 'x-quota-Organization-limit': 'per_hour;q=200;r=150;t=3600' };
24+
it('should return a valid TokenQuotaBucket when auth0-organization-quota-limit header is present', () => {
25+
const headers = { 'auth0-organization-quota-limit': 'per_hour;q=200;r=150;t=3600' };
2626
const result = HttpResponseHeadersUtils.getOrganizationQuotaLimit(headers);
2727
expect(result).toEqual({
28-
perHour: { quota: 200, remaining: 150, time: 3600 },
28+
perHour: { quota: 200, remaining: 150, resetAfter: 3600 },
2929
perDay: undefined,
3030
});
3131
});
@@ -42,16 +42,16 @@ describe('HttpResponseHeadersUtils', () => {
4242
const tokenQuota = 'per_hour;q=300;r=250;t=3600,per_day;q=3000;r=2500;t=86400';
4343
const result = HttpResponseHeadersUtils['parseQuota'](tokenQuota);
4444
expect(result).toEqual({
45-
perHour: { quota: 300, remaining: 250, time: 3600 },
46-
perDay: { quota: 3000, remaining: 2500, time: 86400 },
45+
perHour: { quota: 300, remaining: 250, resetAfter: 3600 },
46+
perDay: { quota: 3000, remaining: 2500, resetAfter: 86400 },
4747
});
4848
});
4949

5050
it('should handle missing attributes gracefully', () => {
5151
const tokenQuota = 'per_hour;q=300;r=250';
5252
const result = HttpResponseHeadersUtils['parseQuota'](tokenQuota);
5353
expect(result).toEqual({
54-
perHour: { quota: 300, remaining: 250, time: 0 },
54+
perHour: { quota: 300, remaining: 250, resetAfter: 0 },
5555
perDay: undefined,
5656
});
5757
});

0 commit comments

Comments
 (0)