feat/Update_Controllers_to_Allow_for_Premium_Membership
This commit is contained in:
@@ -46,6 +46,30 @@ function renderView() {
|
||||
|
||||
beforeEach(() => {
|
||||
mockedApi.get.mockImplementation((url: string) => {
|
||||
if (url === '/ai/settings') {
|
||||
return Promise.resolve({
|
||||
data: {
|
||||
enabled: true,
|
||||
externalProcessingAllowed: false,
|
||||
externalProcessingAvailable: false,
|
||||
effectiveExternalProcessing: false,
|
||||
provider: 'local',
|
||||
},
|
||||
} as any);
|
||||
}
|
||||
if (url === '/ai/usage') {
|
||||
return Promise.resolve({ data: {
|
||||
currentMonth: { calls: 0, estimatedTokens: 0 },
|
||||
plan: 'free',
|
||||
monthlyCallLimit: 0,
|
||||
monthlyTokenLimit: 0,
|
||||
storageUsedBytes: 0,
|
||||
storageLimitBytes: 250_000_000,
|
||||
} } as any);
|
||||
}
|
||||
if (url === '/billing/status') {
|
||||
return Promise.resolve({ data: { enabled: false, canCheckout: false, canManage: false } } as any);
|
||||
}
|
||||
if (url === '/rules') {
|
||||
return Promise.resolve({
|
||||
data: {
|
||||
@@ -62,6 +86,14 @@ beforeEach(() => {
|
||||
return Promise.resolve({ data: {} } as any);
|
||||
});
|
||||
window.localStorage.clear();
|
||||
mockedApi.put.mockImplementation((url: string, body: any) => Promise.resolve({
|
||||
data: {
|
||||
...body,
|
||||
externalProcessingAvailable: false,
|
||||
effectiveExternalProcessing: false,
|
||||
provider: 'local',
|
||||
},
|
||||
} as any));
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
@@ -84,3 +116,18 @@ test('settings view has no accent picker and uses one follow-up section, one not
|
||||
expect(screen.getByLabelText(/email reminders for follow-ups/i)).toBeInTheDocument();
|
||||
expect(screen.getByLabelText(/email alerts for ghosted jobs/i)).toBeInTheDocument();
|
||||
});
|
||||
|
||||
test('AI privacy settings are server-backed and external processing is local-only by default', async () => {
|
||||
renderView();
|
||||
|
||||
expect(await screen.findByText(/AI privacy/i)).toBeInTheDocument();
|
||||
const external = screen.getByLabelText(/allow approved external AI processing/i);
|
||||
expect(external).toBeDisabled();
|
||||
fireEvent.click(screen.getByLabelText(/enable AI features for my account/i));
|
||||
fireEvent.click(screen.getByRole('button', { name: /save AI privacy settings/i }));
|
||||
|
||||
expect(mockedApi.put).toHaveBeenCalledWith('/ai/settings', {
|
||||
enabled: false,
|
||||
externalProcessingAllowed: false,
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user