Skip to content

Commit

Permalink
fix(demo): pause new demo (NangoHQ#1851)
Browse files Browse the repository at this point in the history
## Describe your changes

Fixes NAN-541

Update to reflect change in syncs name
  • Loading branch information
bodinsamuel authored Mar 14, 2024
1 parent 2a9ddda commit 6b79884
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
10 changes: 6 additions & 4 deletions packages/jobs/lib/crons/autoIdleDemo.integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ import {
createSchedule,
ScheduleStatus,
SyncClient,
resultOk
resultOk,
DEMO_GITHUB_CONFIG_KEY,
DEMO_SYNC_NAME
} from '@nangohq/shared';
import { exec } from './autoIdleDemo.js';
import { nanoid } from 'nanoid';
Expand All @@ -33,15 +35,15 @@ describe('Auto Idle Demo', () => {
const connName = nanoid();
const env = await environmentService.createEnvironment(0, envName);
await configService.createProviderConfig({
unique_key: 'demo-github-integration',
unique_key: DEMO_GITHUB_CONFIG_KEY,
provider: 'github',
environment_id: env!.id,
oauth_client_id: '',
oauth_client_secret: ''
});
const conn = await connectionService.upsertConnection(connName, 'demo-github-integration', 'github', {} as any, {}, env!.id, 0);
const conn = await connectionService.upsertConnection(connName, DEMO_GITHUB_CONFIG_KEY, 'github', {} as any, {}, env!.id, 0);
const connId = conn[0]!.id;
const sync = (await createSync(connId, 'github-issues-lite'))!;
const sync = (await createSync(connId, DEMO_SYNC_NAME))!;
await createSchedule(sync.id!, '86400', 0, ScheduleStatus.RUNNING, nanoid());
const schedBefore = await getSchedule(sync.id!);
expect(schedBefore?.status).toBe(ScheduleStatus.RUNNING);
Expand Down
5 changes: 3 additions & 2 deletions packages/shared/lib/services/sync/sync.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import {
} from './config/config.service.js';
import syncOrchestrator from './orchestrator.service.js';
import connectionService from '../connection.service.js';
import { DEMO_GITHUB_CONFIG_KEY, DEMO_SYNC_NAME } from '../onboarding.service.js';

const TABLE = dbNamespace + 'syncs';
const SYNC_JOB_TABLE = dbNamespace + 'sync_jobs';
Expand Down Expand Up @@ -729,9 +730,9 @@ export async function findPausableDemoSyncs(): Promise<PausableSyncs[]> {
})
.join('_nango_sync_schedules', '_nango_sync_schedules.sync_id', '_nango_syncs.id')
.where({
'_nango_syncs.name': 'github-issues-lite',
'_nango_syncs.name': DEMO_SYNC_NAME,
'_nango_environments.name': 'dev',
'_nango_configs.unique_key': 'demo-github-integration',
'_nango_configs.unique_key': DEMO_GITHUB_CONFIG_KEY,
'_nango_configs.provider': 'github',
'_nango_syncs.deleted': false,
'_nango_sync_schedules.status': ScheduleStatus.RUNNING
Expand Down

0 comments on commit 6b79884

Please sign in to comment.