Skip to content

Commit 4ef842e

Browse files
committed
Fix tests
1 parent e36daa5 commit 4ef842e

File tree

15 files changed

+62
-253
lines changed

15 files changed

+62
-253
lines changed

packages/twenty-sdk/src/cli/__tests__/apps/rich-app/__e2e__/applications-install-delete-reinstall.e2e-spec.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
import { getTestedApplicationPath } from '@/cli/__tests__/e2e/utils/get-tested-application-path.util';
2-
import { AppSyncCommand } from '@/cli/commands/app/app-sync';
32
import { AppUninstallCommand } from '@/cli/commands/app/app-uninstall';
43
import { existsSync } from 'fs';
54
import { inspect } from 'util';
5+
import { AppDevCommand } from '@/cli/commands/app/app-dev';
6+
import { join } from 'path';
67

78
inspect.defaultOptions.depth = 10;
89

910
describe('Application: install delete and reinstall rich-app', () => {
1011
const applicationName = 'rich-app';
11-
const syncCommand = new AppSyncCommand();
12+
const appDevCommand = new AppDevCommand();
1213
const deleteCommand = new AppUninstallCommand();
1314
const appPath = getTestedApplicationPath(applicationName);
1415

@@ -26,9 +27,9 @@ describe('Application: install delete and reinstall rich-app', () => {
2627
});
2728

2829
it(`should successfully install ${applicationName} application`, async () => {
29-
const result = await syncCommand.execute(appPath);
30+
await appDevCommand.execute({ appPath });
3031

31-
expect(result.success).toBe(true);
32+
expect(existsSync(join(appPath, 'manifest.json'))).toBe(true);
3233
});
3334

3435
it(`should successfully delete ${applicationName} application`, async () => {
@@ -41,8 +42,8 @@ describe('Application: install delete and reinstall rich-app', () => {
4142
});
4243

4344
it(`should successfully re-install ${applicationName} application`, async () => {
44-
const result = await syncCommand.execute(appPath);
45+
await appDevCommand.execute({ appPath });
4546

46-
expect(result.success).toBe(true);
47+
expect(existsSync(join(appPath, 'manifest.json'))).toBe(true);
4748
});
4849
});

packages/twenty-sdk/src/cli/__tests__/apps/rich-app/__integration__/app-build/app-build.integration.spec.ts

Lines changed: 0 additions & 25 deletions
This file was deleted.

packages/twenty-sdk/src/cli/__tests__/apps/rich-app/__integration__/app-build/tests/console-output.tests.ts

Lines changed: 0 additions & 52 deletions
This file was deleted.

packages/twenty-sdk/src/cli/__tests__/apps/rich-app/__integration__/app-dev/tests/console-output.tests.ts

Lines changed: 11 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -14,34 +14,23 @@ export const defineConsoleOutputTests = (
1414
expect(output).toContain('[init] 📁 App Path:');
1515
});
1616

17-
it('should contain manifest-watch messages', () => {
18-
const output = getOutputByPrefix(getResult().output, 'manifest-watch');
19-
20-
expect(output).toContain('[manifest-watch] 🔄 Building...');
21-
expect(output).toContain('[manifest-watch] ✓ Loaded "Hello World"');
22-
expect(output).toContain('[manifest-watch] ✓ Found 2 object(s)');
23-
expect(output).toContain('[manifest-watch] ✓ Found 4 function(s)');
24-
expect(output).toContain('[manifest-watch] ✓ Found 4 front component(s)');
25-
expect(output).toContain('[manifest-watch] ✓ Found 2 role(s)');
26-
expect(output).toContain('[manifest-watch] ✓ Written to');
27-
expect(output).toContain('[manifest-watch] 📂 Watcher started');
17+
it('should contain dev-mode build messages', () => {
18+
const output = getOutputByPrefix(getResult().output, 'dev-mode');
19+
20+
expect(output).toContain('[dev-mode] Building manifest...');
21+
expect(output).toContain('[dev-mode] Successfully built manifest');
2822
});
2923

30-
it('should contain functions-watch messages', () => {
31-
const output = getOutputByPrefix(getResult().output, 'functions-watch');
24+
it('should contain dev-mode function build messages', () => {
25+
const output = getOutputByPrefix(getResult().output, 'dev-mode');
3226

33-
expect(output).toContain('[functions-watch] 📦 Building...');
34-
expect(output).toContain('[functions-watch] ✓ Built');
27+
expect(output).toContain('[dev-mode] ✓ Successfully built');
3528
});
3629

37-
it('should contain front-components-watch messages', () => {
38-
const output = getOutputByPrefix(
39-
getResult().output,
40-
'front-components-watch',
41-
);
30+
it('should contain dev-mode sync messages', () => {
31+
const output = getOutputByPrefix(getResult().output, 'dev-mode');
4232

43-
expect(output).toContain('[front-components-watch] 🎨 Building...');
44-
expect(output).toContain('[front-components-watch] ✓ Built');
33+
expect(output).toContain('[dev-mode] ✓ Synced');
4534
});
4635
});
4736
};
Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
export const testFunction2 = () => {
2-
const Twenty = require('../../generated').default;
3-
4-
const client = new Twenty();
5-
6-
return client.query('testQuery');
2+
// This is a test utility function for integration tests
3+
return 'test-function-2-result';
74
};

packages/twenty-sdk/src/cli/__tests__/apps/root-app/__integration__/app-build/app-build.integration.spec.ts

Lines changed: 0 additions & 25 deletions
This file was deleted.

packages/twenty-sdk/src/cli/__tests__/apps/root-app/__integration__/app-build/tests/console-output.tests.ts

Lines changed: 0 additions & 52 deletions
This file was deleted.

packages/twenty-sdk/src/cli/__tests__/apps/root-app/__integration__/app-dev/expected-manifest.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ export const EXPECTED_MANIFEST: ApplicationManifest = {
8686
],
8787
handlerName: 'myHandler',
8888
sourceHandlerPath: 'my.function.ts',
89-
builtHandlerPath: 'functions/my.function.mjs',
89+
builtHandlerPath: 'my.function.mjs',
9090
builtHandlerChecksum: '[checksum]',
9191
},
9292
],
@@ -97,7 +97,7 @@ export const EXPECTED_MANIFEST: ApplicationManifest = {
9797
description: 'A root-level front component',
9898
componentName: 'MyComponent',
9999
sourceComponentPath: 'my.front-component.tsx',
100-
builtComponentPath: 'front-components/my.front-component.mjs',
100+
builtComponentPath: 'my.front-component.mjs',
101101
builtComponentChecksum: '[checksum]',
102102
},
103103
],

packages/twenty-sdk/src/cli/__tests__/apps/root-app/__integration__/app-dev/tests/console-output.tests.ts

Lines changed: 11 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -14,34 +14,23 @@ export const defineConsoleOutputTests = (
1414
expect(output).toContain('[init] 📁 App Path:');
1515
});
1616

17-
it('should contain manifest-watch messages', () => {
18-
const output = getOutputByPrefix(getResult().output, 'manifest-watch');
19-
20-
expect(output).toContain('[manifest-watch] 🔄 Building...');
21-
expect(output).toContain('[manifest-watch] ✓ Loaded "Root App"');
22-
expect(output).toContain('[manifest-watch] ✓ Found 1 object(s)');
23-
expect(output).toContain('[manifest-watch] ✓ Found 1 function(s)');
24-
expect(output).toContain('[manifest-watch] ✓ Found 1 front component(s)');
25-
expect(output).toContain('[manifest-watch] ✓ Found 1 role(s)');
26-
expect(output).toContain('[manifest-watch] ✓ Written to');
27-
expect(output).toContain('[manifest-watch] 📂 Watcher started');
17+
it('should contain dev-mode build messages', () => {
18+
const output = getOutputByPrefix(getResult().output, 'dev-mode');
19+
20+
expect(output).toContain('[dev-mode] Building manifest...');
21+
expect(output).toContain('[dev-mode] Successfully built manifest');
2822
});
2923

30-
it('should contain functions-watch messages', () => {
31-
const output = getOutputByPrefix(getResult().output, 'functions-watch');
24+
it('should contain dev-mode function build messages', () => {
25+
const output = getOutputByPrefix(getResult().output, 'dev-mode');
3226

33-
expect(output).toContain('[functions-watch] 📦 Building...');
34-
expect(output).toContain('[functions-watch] ✓ Built');
27+
expect(output).toContain('[dev-mode] ✓ Successfully built');
3528
});
3629

37-
it('should contain front-components-watch messages', () => {
38-
const output = getOutputByPrefix(
39-
getResult().output,
40-
'front-components-watch',
41-
);
30+
it('should contain dev-mode sync messages', () => {
31+
const output = getOutputByPrefix(getResult().output, 'dev-mode');
4232

43-
expect(output).toContain('[front-components-watch] 🎨 Building...');
44-
expect(output).toContain('[front-components-watch] ✓ Built');
33+
expect(output).toContain('[dev-mode] ✓ Synced');
4534
});
4635
});
4736
};

packages/twenty-sdk/src/cli/__tests__/apps/root-app/__integration__/app-dev/tests/front-components.tests.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ import { join } from 'path';
44
export const defineFrontComponentsTests = (appPath: string): void => {
55
describe('front-components', () => {
66
it('should have built front components at root level', async () => {
7-
const frontComponentsDir = join(
8-
appPath,
9-
'.twenty/output/front-components',
10-
);
11-
const files = await fs.readdir(frontComponentsDir, { recursive: true });
12-
const sortedFiles = files.map((f) => f.toString()).sort();
7+
const outputDir = join(appPath, '.twenty/output');
8+
const files = await fs.readdir(outputDir, { recursive: true });
9+
const componentFiles = files
10+
.map((f) => f.toString())
11+
.filter((f) => f.includes('.front-component.'))
12+
.sort();
1313

14-
expect(sortedFiles).toEqual([
14+
expect(componentFiles).toEqual([
1515
'my.front-component.mjs',
1616
'my.front-component.mjs.map',
1717
]);

0 commit comments

Comments
 (0)