AFFiNE/tests/unit/compare-config.spec.ts
2023-03-23 17:15:40 -05:00

22 lines
769 B
TypeScript

import { expect, test } from 'vitest';
test('compare config', async () => {
const { default: nextConfigMock } = await import(
'../../scripts/vitest/next-config-mock'
);
const mockConfig = nextConfigMock().publicRuntimeConfig;
const { default: nextConfig } = await import(
'../../apps/web/next.config.mjs'
);
const config = nextConfig.publicRuntimeConfig;
Object.keys(config).forEach(key => {
expect(key in mockConfig, `${key} should be in the mockConfig`).toBe(true);
expect(typeof config[key], `${key}`).toBe(typeof mockConfig[key]);
});
Object.keys(mockConfig).forEach(key => {
expect(key in config, `${key} should be in the config`).toBe(true);
expect(typeof config[key], `${key}`).toBe(typeof mockConfig[key]);
});
});