mirror of
https://github.com/whekin/household-bot.git
synced 2026-03-31 15:54:03 +00:00
feat(finance): support weighted rent split
This commit is contained in:
@@ -100,6 +100,7 @@ function createRepositoryStub() {
|
||||
displayName: input.displayName,
|
||||
preferredLocale: input.preferredLocale ?? null,
|
||||
householdDefaultLocale: household.defaultLocale,
|
||||
rentShareWeight: 1,
|
||||
isAdmin: input.isAdmin === true
|
||||
}
|
||||
members.set(input.telegramUserId, member)
|
||||
@@ -133,6 +134,7 @@ function createRepositoryStub() {
|
||||
displayName: pending.displayName,
|
||||
preferredLocale: null,
|
||||
householdDefaultLocale: household.defaultLocale,
|
||||
rentShareWeight: 1,
|
||||
isAdmin: input.isAdmin === true
|
||||
}
|
||||
},
|
||||
@@ -190,6 +192,9 @@ function createRepositoryStub() {
|
||||
},
|
||||
async promoteHouseholdAdmin() {
|
||||
return null
|
||||
},
|
||||
async updateHouseholdMemberRentShareWeight() {
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
@@ -319,6 +324,7 @@ describe('createHouseholdOnboardingService', () => {
|
||||
displayName: 'Stan',
|
||||
preferredLocale: null,
|
||||
householdDefaultLocale: 'ru',
|
||||
rentShareWeight: 1,
|
||||
isAdmin: true
|
||||
}
|
||||
})
|
||||
@@ -333,13 +339,14 @@ describe('createHouseholdOnboardingService', () => {
|
||||
displayName: 'Stan',
|
||||
preferredLocale: null,
|
||||
householdDefaultLocale: 'ru',
|
||||
rentShareWeight: 1,
|
||||
isAdmin: true
|
||||
}
|
||||
const service = createHouseholdOnboardingService({ repository })
|
||||
const duplicateRepository = repository as HouseholdConfigurationRepository & {
|
||||
listHouseholdMembersByTelegramUserId: (
|
||||
telegramUserId: string
|
||||
) => Promise<readonly HouseholdMemberRecord[]>
|
||||
) => Promise<readonly (HouseholdMemberRecord & { rentShareWeight: number })[]>
|
||||
}
|
||||
duplicateRepository.listHouseholdMembersByTelegramUserId = async () => [
|
||||
member,
|
||||
@@ -350,6 +357,7 @@ describe('createHouseholdOnboardingService', () => {
|
||||
displayName: 'Stan elsewhere',
|
||||
preferredLocale: null,
|
||||
householdDefaultLocale: 'ru',
|
||||
rentShareWeight: 1,
|
||||
isAdmin: false
|
||||
}
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user