forked from Yara724/api
dynamic locations
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
import { SEED_FANAVARAN_CLIENT_PROFILES } from "src/core/config/fanavaran-client.config";
|
||||
import { FanavaranClientConfigService } from "./fanavaran-client-config.service";
|
||||
|
||||
describe("Moallem attachment file type", () => {
|
||||
it("seeds file type 17 for Moallem and retains the other tenant file types", () => {
|
||||
expect(
|
||||
SEED_FANAVARAN_CLIENT_PROFILES.moallem.defaults.ClaimFileTypeId,
|
||||
).toBe(17);
|
||||
expect(
|
||||
SEED_FANAVARAN_CLIENT_PROFILES.parsian.defaults.ClaimFileTypeId,
|
||||
).toBe(63);
|
||||
expect(
|
||||
SEED_FANAVARAN_CLIENT_PROFILES.tejaratno.defaults.ClaimFileTypeId,
|
||||
).toBe(23);
|
||||
});
|
||||
|
||||
it("migrates only Moallem's old shared default on existing installations", async () => {
|
||||
const service = Object.create(
|
||||
FanavaranClientConfigService.prototype,
|
||||
) as any;
|
||||
service.configModel = {
|
||||
updateOne: jest.fn().mockResolvedValue({ modifiedCount: 1 }),
|
||||
findOne: jest.fn().mockReturnValue({
|
||||
select: () => ({
|
||||
lean: () => ({ exec: async () => ({ _id: "existing" }) }),
|
||||
}),
|
||||
}),
|
||||
create: jest.fn(),
|
||||
};
|
||||
await service.seedMissingProfiles();
|
||||
expect(service.configModel.updateOne).toHaveBeenCalledTimes(1);
|
||||
expect(service.configModel.updateOne).toHaveBeenCalledWith(
|
||||
{ key: "moallem", "defaults.ClaimFileTypeId": 23 },
|
||||
{ $set: { "defaults.ClaimFileTypeId": 17 } },
|
||||
);
|
||||
expect(service.configModel.create).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user