Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion __tests__/functional/e2e.functional.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ describe('E2E Test Cases', () => {
clientId: process.env.VITE_ATHENA_CLIENT_ID ?? '',
clientSecret: process.env.VITE_ATHENA_CLIENT_SECRET ?? '',
audience: parseAudience(process.env.VITE_ATHENA_AUDIENCE),
scope: 'manage:classify',
},
});

Expand Down
18 changes: 12 additions & 6 deletions __tests__/functional/main.functional.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
ClassifierSdk,
type ClassifyImageInput,
ImageFormat,
parseAudience,
} from '../../src/index.js';
import fs from 'fs';
import { randomUUID } from 'crypto';
Expand All @@ -18,11 +19,12 @@ describe('ClassifierSdk Functional Tests', () => {
const sdk = new ClassifierSdk({
deploymentId: process.env.VITE_ATHENA_DEPLOYMENT_ID,
affiliate: process.env.VITE_ATHENA_AFFILIATE,
grpcAddress: process.env.VITE_ATHENA_GRPC_ADDRESS,
authentication: {
issuerUrl: process.env.VITE_OAUTH_ISSUER,
clientId: process.env.VITE_ATHENA_CLIENT_ID,
clientSecret: process.env.VITE_ATHENA_CLIENT_SECRET,
scope: 'manage:classify',
audience: parseAudience(process.env.VITE_ATHENA_AUDIENCE),
},
});

Expand All @@ -46,11 +48,12 @@ describe('ClassifierSdk Functional Tests', () => {
const sdk = new ClassifierSdk({
deploymentId: process.env.VITE_ATHENA_DEPLOYMENT_ID,
affiliate: process.env.VITE_ATHENA_AFFILIATE,
grpcAddress: process.env.VITE_ATHENA_GRPC_ADDRESS,
authentication: {
issuerUrl: process.env.VITE_OAUTH_ISSUER,
clientId: process.env.VITE_ATHENA_CLIENT_ID,
clientSecret: process.env.VITE_ATHENA_CLIENT_SECRET,
scope: 'manage:classify',
audience: parseAudience(process.env.VITE_ATHENA_AUDIENCE),
},
});

Expand All @@ -60,7 +63,7 @@ describe('ClassifierSdk Functional Tests', () => {
};

const response = await sdk.classifySingle(input);
expect(response.classifications).toBe(true);
expect(Array.isArray(response.classifications)).toBe(true);
expect(response.error).toBeNull();
}, 10000);
});
Expand All @@ -76,11 +79,12 @@ describe('ClassifierSdk Functional Tests', () => {
const sdk = new ClassifierSdk({
deploymentId: process.env.VITE_ATHENA_DEPLOYMENT_ID,
affiliate: process.env.VITE_ATHENA_AFFILIATE,
grpcAddress: process.env.VITE_ATHENA_GRPC_ADDRESS,
authentication: {
issuerUrl: process.env.VITE_OAUTH_ISSUER,
clientId: process.env.VITE_ATHENA_CLIENT_ID,
clientSecret: process.env.VITE_ATHENA_CLIENT_SECRET,
scope: 'manage:classify',
audience: parseAudience(process.env.VITE_ATHENA_AUDIENCE),
},
});

Expand Down Expand Up @@ -172,11 +176,12 @@ describe('ClassifierSdk Functional Tests', () => {
const sdk = new ClassifierSdk({
deploymentId: process.env.VITE_ATHENA_DEPLOYMENT_ID,
affiliate: process.env.VITE_ATHENA_AFFILIATE,
grpcAddress: process.env.VITE_ATHENA_GRPC_ADDRESS,
authentication: {
issuerUrl: process.env.VITE_OAUTH_ISSUER,
clientId: process.env.VITE_ATHENA_CLIENT_ID,
clientSecret: process.env.VITE_ATHENA_CLIENT_SECRET,
scope: 'manage:classify',
audience: parseAudience(process.env.VITE_ATHENA_AUDIENCE),
},
});

Expand Down Expand Up @@ -257,11 +262,12 @@ describe('ClassifierSdk Functional Tests', () => {
const sdk = new ClassifierSdk({
deploymentId: process.env.VITE_ATHENA_DEPLOYMENT_ID,
affiliate: process.env.VITE_ATHENA_AFFILIATE,
grpcAddress: process.env.VITE_ATHENA_GRPC_ADDRESS,
authentication: {
issuerUrl: process.env.VITE_OAUTH_ISSUER,
clientId: process.env.VITE_ATHENA_CLIENT_ID,
clientSecret: process.env.VITE_ATHENA_CLIENT_SECRET,
scope: 'manage:classify',
audience: parseAudience(process.env.VITE_ATHENA_AUDIENCE),
},
});

Expand Down
3 changes: 1 addition & 2 deletions __tests__/unit/authenticationManager.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ const options: AuthenticationOptions = {
clientId: 'client-id',
clientSecret: 'client-secret',
issuerUrl: 'https://issuer.example.com',
scope: 'manage:classify',
};

describe('AuthenticationManager', () => {
Expand All @@ -46,7 +45,7 @@ describe('AuthenticationManager', () => {
);
expect(openidClient.clientCredentialsGrant).toHaveBeenCalledWith(
mockDiscovery,
{ audience: 'crisp-athena-live', scope: options.scope },
{ audience: 'crisp-athena-live' },
);
});

Expand Down
3 changes: 0 additions & 3 deletions __tests__/unit/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ describe('ClassifierSdk', () => {
issuerUrl: 'https://test-issuer.com',
clientId: 'test-client-id',
clientSecret: 'test-client-secret',
scope: 'manage:classify',
},
});
});
Expand All @@ -57,7 +56,6 @@ describe('ClassifierSdk', () => {
issuerUrl: 'https://test-issuer.com',
clientId: 'test-client-id',
clientSecret: 'test-client-secret',
scope: 'manage:classify',
},
});

Expand All @@ -74,7 +72,6 @@ describe('ClassifierSdk', () => {
issuerUrl: 'https://test-issuer.com',
clientId: 'test-client-id',
clientSecret: 'test-client-secret',
scope: 'manage:classify',
},
});

Expand Down
1 change: 0 additions & 1 deletion __tests__/unit/module-import.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ describe('Module Import Tests', () => {
issuerUrl: 'https://test-issuer.com',
clientId: 'test-client-id',
clientSecret: 'test-client-secret',
scope: 'manage:classify',
},
});

Expand Down
Loading