Skip to content

Commit

Permalink
fixes failing spec (ToolJet#2425)
Browse files Browse the repository at this point in the history
  • Loading branch information
akshaysasidrn authored Mar 3, 2022
1 parent 0ea41d9 commit e81c7cd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions server/src/controllers/apps.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,12 @@ export class AppsController {
const app = await this.appsService.findBySlug(params.slug);
const versionToLoad = app.currentVersionId
? await this.appsService.findVersion(app.currentVersionId)
: await this.appsService.findVersion(app.editingVersion.id);
: await this.appsService.findVersion(app.editingVersion?.id);

// serialize
return {
current_version_id: app['currentVersionId'],
data_queries: versionToLoad.dataQueries,
data_queries: versionToLoad?.dataQueries,
definition: versionToLoad?.definition,
is_public: app.isPublic,
name: app.name,
Expand Down
4 changes: 3 additions & 1 deletion server/test/controllers/apps.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1193,6 +1193,7 @@ describe('apps controller', () => {
user: adminUserData.user,
slug: 'foo',
});
await createApplicationVersion(app, application);
// setup app permissions for developer
const developerUserGroup = await getRepository(GroupPermission).findOne({
where: {
Expand Down Expand Up @@ -1234,12 +1235,13 @@ describe('apps controller', () => {
email: 'another@tooljet.io',
groups: ['all_users', 'admin'],
});
await createApplication(app, {
const application = await createApplication(app, {
name: 'name',
user: adminUserData.user,
slug: 'foo',
});

await createApplicationVersion(app, application);
const response = await request(app.getHttpServer())
.get('/api/apps/slugs/foo')
.set('Authorization', authHeaderForUser(anotherOrgAdminUserData.user));
Expand Down

0 comments on commit e81c7cd

Please sign in to comment.