-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #230 from shopware/fix-saas-issues-2
fix: use correct system-config endpoint
- Loading branch information
Showing
8 changed files
with
120 additions
and
100 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* eslint-disable playwright/no-conditional-expect */ | ||
import { | ||
test, | ||
expect, | ||
APIResponse, | ||
SystemConfig, | ||
} from '../../src'; | ||
|
||
test('System config can be overwritten and is restored to defaults', async ({ | ||
AdminApiContext, | ||
TestDataService, | ||
DefaultSalesChannel, | ||
}) => { | ||
const fetchConfig = async (domain) => { | ||
const response = await AdminApiContext.get(`_action/system-config?domain=${domain}&inherit=1&salesChannelId=${DefaultSalesChannel.salesChannel.id}`); | ||
return (await response.json()) as { data: SystemConfig }; | ||
}; | ||
const defaults = await fetchConfig('core.register'); | ||
expect(defaults['core.register.minPasswordLength']).toBeDefined(); | ||
|
||
const overrides = { | ||
'test.random.foo': true, | ||
'core.register.minPasswordLength': 1337, | ||
}; | ||
|
||
await TestDataService.setSystemConfig(overrides); | ||
|
||
const c2 = await fetchConfig('core.register'); | ||
expect(c2['core.register.minPasswordLength']).toBeDefined(); | ||
expect(c2['core.register.minPasswordLength']).toStrictEqual(overrides['core.register.minPasswordLength']); | ||
|
||
const c1 = await fetchConfig('test.random'); | ||
expect(c1['test.random.foo']).toBeDefined(); | ||
expect(c1['test.random.foo']).toStrictEqual(overrides['test.random.foo']); | ||
|
||
// Test data clean-up with activated cleansing process | ||
TestDataService.setCleanUp(true); | ||
const cleanUpDeleteOperationsResponse = await TestDataService.cleanUp() as APIResponse; | ||
expect(cleanUpDeleteOperationsResponse.ok()).toBeTruthy(); | ||
|
||
const afterCleanUpTest = await fetchConfig('test.random'); | ||
expect(afterCleanUpTest['test.random.foo']).not.toBeDefined(); | ||
|
||
const afterCleanUpCore = await fetchConfig('core.register'); | ||
expect(afterCleanUpCore['core.register.minPasswordLength']).toBeDefined(); | ||
expect(afterCleanUpCore['core.register.minPasswordLength']).toStrictEqual(defaults['core.register.minPasswordLength']); | ||
}); |
Oops, something went wrong.