Skip to content

Commit 7a78747

Browse files
authored
chore(core): clean up legacy test cases (#7256)
clean up legacy test cases
1 parent 6ccb3a3 commit 7a78747

File tree

1 file changed

+29
-37
lines changed

1 file changed

+29
-37
lines changed

packages/core/src/middleware/koa-spa-proxy.test.ts

Lines changed: 29 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -86,49 +86,41 @@ describe('koaSpaProxy middleware', () => {
8686
stub.restore();
8787
});
8888

89-
it.each([true, false])(
90-
'production env should call the proxy middleware if path does not hit the ui file directory: devFeatureEnabled %p',
91-
async (isDevFeaturesEnabled) => {
92-
const stub = Sinon.stub(EnvSet, 'values').value({
93-
...EnvSet.values,
94-
isProduction: true,
95-
isDevFeaturesEnabled,
96-
});
89+
it('production env should call the proxy middleware if path does not hit the ui file directory', async () => {
90+
const stub = Sinon.stub(EnvSet, 'values').value({
91+
...EnvSet.values,
92+
isProduction: true,
93+
});
9794

98-
const ctx = createContextWithRouteParameters({
99-
url: '/sign-in',
100-
});
95+
const ctx = createContextWithRouteParameters({
96+
url: '/sign-in',
97+
});
10198

102-
await koaSpaProxy({ mountedApps, queries })(ctx, next);
99+
await koaSpaProxy({ mountedApps, queries })(ctx, next);
103100

104-
const packagePath = 'experience';
105-
const distributionPath = path.join('node_modules/@logto', packagePath, 'dist');
101+
const packagePath = 'experience';
102+
const distributionPath = path.join('node_modules/@logto', packagePath, 'dist');
106103

107-
expect(mockStaticMiddlewareFactory).toBeCalledWith(distributionPath);
108-
stub.restore();
109-
}
110-
);
104+
expect(mockStaticMiddlewareFactory).toBeCalledWith(distributionPath);
105+
stub.restore();
106+
});
111107

112-
it.each([true, false])(
113-
'should serve custom UI assets if user uploaded them: : devFeatureEnabled %p',
114-
async (isDevFeaturesEnabled) => {
115-
const stub = Sinon.stub(EnvSet, 'values').value({
116-
...EnvSet.values,
117-
isDevFeaturesEnabled,
118-
});
108+
it('should serve custom UI assets if user uploaded them', async () => {
109+
const stub = Sinon.stub(EnvSet, 'values').value({
110+
...EnvSet.values,
111+
});
119112

120-
const customUiAssets = { id: 'custom-ui-assets', createdAt: Date.now() };
121-
mockFindDefaultSignInExperience.mockResolvedValue({ customUiAssets });
113+
const customUiAssets = { id: 'custom-ui-assets', createdAt: Date.now() };
114+
mockFindDefaultSignInExperience.mockResolvedValue({ customUiAssets });
122115

123-
const ctx = createContextWithRouteParameters({
124-
url: '/sign-in',
125-
});
116+
const ctx = createContextWithRouteParameters({
117+
url: '/sign-in',
118+
});
126119

127-
await koaSpaProxy({ mountedApps, queries })(ctx, next);
128-
expect(mockCustomUiAssetsMiddleware).toBeCalled();
129-
expect(mockStaticMiddleware).not.toBeCalled();
130-
expect(mockProxyMiddleware).not.toBeCalled();
131-
stub.restore();
132-
}
133-
);
120+
await koaSpaProxy({ mountedApps, queries })(ctx, next);
121+
expect(mockCustomUiAssetsMiddleware).toBeCalled();
122+
expect(mockStaticMiddleware).not.toBeCalled();
123+
expect(mockProxyMiddleware).not.toBeCalled();
124+
stub.restore();
125+
});
134126
});

0 commit comments

Comments
 (0)