Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: enforce behavior via test #4701

Merged
merged 3 commits into from
Sep 14, 2023
Merged
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
40 changes: 40 additions & 0 deletions src/test/e2e/services/project-service.e2e.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1777,3 +1777,43 @@ test('should return average time to production per toggle and include archived t

expect(resultProject1.features).toHaveLength(3);
});

describe('feature flag naming patterns', () => {
test(`should clear existing example and description if the payload doesn't contain them`, async () => {
const featureNaming = {
pattern: '.+',
example: 'example',
description: 'description',
};

const project = {
id: 'feature-flag-naming-patterns-cleanup',
name: 'Project',
mode: 'open' as const,
defaultStickiness: 'clientId',
description: 'description',
featureNaming,
};

await projectService.createProject(project, user.id);

expect(
(await projectService.getProject(project.id)).featureNaming,
).toMatchObject(featureNaming);

const newPattern = 'new-pattern.+';
await projectService.updateProject(
{
...project,
featureNaming: { pattern: newPattern },
},
user.id,
);

const updatedProject = await projectService.getProject(project.id);

expect(updatedProject.featureNaming!.pattern).toBe(newPattern);
expect(updatedProject.featureNaming!.example).toBeFalsy();
expect(updatedProject.featureNaming!.description).toBeFalsy();
});
});