← Raashid calculator

Test cases

The calculation engine is locked behind an automated test suite. Every check below runs against the real calculator before any change is accepted, so the results you see in the app match the figures listed here. All 158 tests currently pass.

158 of 158 tests shown

Core fara'id engine & exact fractions

The foundation: exact fractional arithmetic, spouse and children shares, parents and grandparents, siblings, the 'awl and radd correction rules, and money handling (debts, funeral costs, bequests).

29 tests · src/lib/inheritance.test.ts

Test caseExpected resultActual result
Fractions reduce to lowest terms2/4 → 1/2; 6/9 → 2/3Passing
Fraction arithmetic is exact1/2 + 1/3 = 5/6; 1/2 − 1/3 = 1/6; 2/3 × 3/4 = 1/2; 1/2 ÷ 1/4 = 2Passing
Negative denominators are normalised1/−2 → −1/2Passing
Division by zero throwsFraction(1, 0) raises an errorPassing
Husband gets 1/2 without children, 1/4 with childrenNo children: Husband 1/2. With a son: Husband 1/4Passing
Wife gets 1/4 without children, 1/8 with childrenNo children: Wife 1/4. With a son: Wife 1/8Passing
Multiple wives share the wife portion equallyTwo wives with a son: 1/16 eachPassing
Sons and daughters share the residue 2:1Wife 1/8; each son 7/20; daughter 7/40; total exactly 1Passing
A single daughter takes 1/2, two or more share 2/3 (radd tops up when alone)With wife: daughter 7/8 after radd; three daughters 7/24 each; alone: daughter takes the whole estatePassing
Daughters become residuary with sons instead of fixed-share heirsDaughter's basis reads “Residuary” when a son is presentPassing
Mother gets 1/3 without children or 2+ siblings, 1/6 otherwiseWith wife only: mother 3/4 after radd; with a son or two brothers: 1/6Passing
Father takes 1/6 plus residue when children existWith a daughter: father totals 1/2 (1/6 fixed + 1/3 residue); total exactly 1Passing
Father is the residuary when there are no childrenWife 1/4; Father 3/4Passing
Grandfather substitutes for a deceased fatherWife 1/4; Grandfather 3/4Passing
Maternal grandmother takes her own 1/6 when mother is absentWith a son: maternal grandmother 1/6Passing
Siblings inherit only when there are no children and no male ascendantA living father or son blocks full brothers; a blocking note is shownPassing
Full brothers and sisters share the residue 2:1Wife 1/4; full brother 1/2; full sister 1/4; total exactly 1Passing
A single full sister takes 1/2, two or more share 2/3 (radd tops up when alone)With husband: sister 1/2; two sisters with husband: 2/7 each after 'awl; alone: whole estatePassing
Paternal siblings inherit only when there are no full siblingsA full brother blocks paternal brothers; alone, a paternal brother takes the whole estatePassing
Maternal siblings take 1/6 singly or 1/3 shared (radd tops up when alone)One: 1/6; two: 1/6 each; alone: whole estate by raddPassing
Applies 'awl when fixed shares exceed the estateWife 1/9, father 4/27, mother 4/27, each daughter 8/27; total exactly 1Passing
Applies radd to non-spouse heirs when there is no residuaryWife keeps 1/4 (spouses excluded from radd); mother rises to 3/4Passing
Leaves surplus to bayt al-mal when only a spouse remainsWife 1/4; the explanation names the public treasury (bayt al-mal)Passing
Reports exact when shares fill the estate preciselyHusband 1/2 + mother 1/3 + maternal sibling 1/6 = exactly 1; rule “exact”Passing
Returns rule 'none' when no heirs are enteredNo heirs listed; rule “none”Passing
Deducts debts and funeral costs before distribution100,000 − 20,000 debts − 10,000 funeral = 70,000 net to the sonPassing
Caps the bequest at one third of the estate after debts60,000 bequest on 90,000 is capped to 30,000; a note explains the capPassing
Applies the bequest in full when within one third20,000 bequest on 90,000 applied in full; net 70,000Passing
Never lets the net estate go below zeroDebts of 5,000 on a 1,000 estate: net 0, heir amount 0Passing

Differences between the four schools

The cases where Hanafi, Maliki, Shafi'i and Hanbali rulings diverge: the 'Umariyyatayn, grandfather with siblings, radd versus the treasury, the mushtaraka, and the school-comparison view.

15 tests · src/lib/inheritance.madhab.test.ts

Test caseExpected resultActual result
'Umariyyatayn — husband + mother + father: mother gets 1/6Husband 1/2; Mother 1/6 (third of the remainder); Father 1/3Passing
'Umariyyatayn — wife + mother + father: mother gets 1/4Wife 1/4; Mother 1/4; Father 1/2Passing
Hanafi: grandfather blocks siblingsGrandfather takes the whole estate; siblings shown as blocked by himPassing
Shafi'i: grandfather shares with siblings (muqasama)Grandfather 1/3; each full brother 1/3; total exactly 1Passing
Grandfather takes 1/3 of the residue when better than sharingWith three brothers: grandfather 1/3; each brother 2/9Passing
Maliki sends surplus to the treasuryOne daughter: daughter 1/2; bayt al-mal 1/2; rule “baytalmal”Passing
Hanbali returns the surplus (radd)One daughter: daughter takes the whole estatePassing
Mushtaraka — Hanafi: full brother gets nothing and is flaggedFull brother excluded and listed as blockedPassing
Mushtaraka — Shafi'i: full brother shares the 1/3Full brother 1/9; each maternal sibling 1/9; total exactly 1Passing
Full brother takes residue after a daughterDaughter 1/2; full brother 1/2Passing
Full sister is residuary alongside daughtersTwo daughters + full sister: sister 1/3Passing
Paternal sister gets 1/6 with one full sisterPaternal sister receives her completing sixthPassing
Blocked list names siblings blocked by a son and grandmother by motherLists “Full siblings (2)”, “Maternal sibling”, and “Maternal grandmother (mother's mother)”Passing
compareSchools returns null when schools agreeWife + son: no divergence reportedPassing
compareSchools reports divergence for grandfather + siblingsFirst topic title mentions the grandfatherPassing

Paternal uncles

Paternal uncles as residuary heirs: who blocks them, how they split the residue, and confirmation that all four schools agree on these outcomes.

13 tests · src/lib/inheritance.uncles.test.ts

Test caseExpected resultActual result
A sole paternal uncle takes the whole estatePaternal uncle 1; rule “asaba”; total exactly 1Passing
Multiple full uncles split the residue equallyThree uncles: 1/3 each; total exactly 1Passing
Full uncles block the father's paternal half-brothersFull uncle takes all; half-uncles listed as blockedPassing
Paternal half-uncles inherit when there are no full unclesTwo half-uncles: 1/2 eachPassing
A son blocks unclesUncle receives nothing; blocked by “Son”Passing
The father blocks unclesUncle receives nothing; blocked by “Father”Passing
The grandfather blocks unclesUncle receives nothing; blocked by “Grandfather”Passing
A full brother blocks unclesUncle receives nothing; blocked by “Full brother”Passing
A paternal brother blocks unclesUncle receives nothing; blocked by “Paternal brother”Passing
Wife + mother + uncle: uncle takes the residueWife 1/4; Mother 1/3; Uncle 5/12; total exactly 1Passing
No residue left: the uncle receives nothingHusband + two full sisters trigger 'awl; uncle listed as blockedPassing
Sisters do not block unclesFull sister 1/2; uncle 1/2; total exactly 1Passing
All four schools agree on uncle outcomesHanafi, Shafi'i, Maliki and Hanbali each give the uncle 5/12Passing

Country adjustments (Section B)

Local-law adjustments that never change the Islamic calculation itself: prior deductions and the obligatory bequest (al-wasiyya al-wajiba) for grandchildren in countries such as Jordan and Egypt.

11 tests · src/lib/inheritance.jurisdiction.test.ts

Test caseExpected resultActual result
No options gives the same result as beforeA zero prior deduction leaves net and every heir amount unchangedPassing
Deducts the prior amount before distributing and before the voluntary bequest30,000 prior deduction on 90,000: net 60,000; a 20,000 bequest is fully capped awayPassing
Prior deduction cannot exceed one third80,000 requested on 90,000: 30,000 applied; net 60,000Passing
Returns null when no jurisdiction is selectedNo country chosen: no adjustmentPassing
Returns null for a country without an obligatory bequestUnited States: no adjustmentPassing
Returns null when no qualifying grandchildren are enteredNo grandchildren: no adjustmentPassing
Caps the bequest at one third when the parent's hypothetical share is largerJordan, 90,000: bequest 30,000 (one third); wife's amount falls from 22,500 to 15,000Passing
Caps the bequest at the parent's hypothetical share when that is smallerBequest = 5/21 of 90,000 ≈ 21,429; mother keeps 1/6 of the reduced estate; sons' residue shrinksPassing
Splits the bequest 2:1 between grandsons and granddaughtersGrandsons receive 2/3 and granddaughters 1/3 of the bequest; the parts sum to the wholePassing
Lists every heir whose share changed as a deviationWife and Father listed; every adjusted amount is lower than the pure amountPassing
getJurisdiction resolves entries by codeMY scope “allChildren”; EG scope “sonsDescendants”; unknown code “XX” returns nullPassing

Two grandmothers & the provisional flag

Maternal and paternal grandmothers: who blocks whom, how they share the sixth, and the amber provisional flag for the Hanbali position on a paternal grandmother with a living father.

12 tests · src/lib/inheritance.grandmothers.test.ts

Test caseExpected resultActual result
Flags the uncalculated Hanbali father/paternal-grandmother case but not HanafiHanbali: unaccounted flag + “not calculated” note; Hanafi: no flag, paternal grandmother blocked by the father; school comparison shows the divergencePassing
Includes the provisional warning in the Hanbali share text, immediately before the linkShared summary contains “PROVISIONAL:” directly before the link, with and without an attached PDFPassing
Does not include a provisional warning in Hanafi for the same familyShared summary contains no “PROVISIONAL” linePassing
Does not include a provisional warning for wife, son and two grandmothersShared summary contains no “PROVISIONAL” linePassing
Does not flag grandmothers blocked by a living motherNo unaccounted entries; paternal grandmother blocked by the motherPassing
A single maternal or paternal grandmother alone receives the whole estate by radd in HanafiOne heir with share 1; basis “1/6 (fixed share by Sunnah; mother absent)” or “…mother and father absent”Passing
Two grandmothers alone split the whole estate equally by radd in HanafiMaternal 1/2; paternal 1/2Passing
Wife and son with two grandmothers: 1/8, 1/12 each, 17/24Wife 1/8; each grandmother 1/12; son 17/24Passing
Both alive share 1/6 equallyEach grandmother 1/12Passing
Paternal grandmother alone takes 1/6Paternal grandmother 1/6Passing
Mother blocks both grandmothersNeither grandmother inherits; two entries blocked by “Mother”Passing
Father blocks paternal grandmother; maternal takes full 1/6Paternal grandmother blocked by “Father”; maternal grandmother 1/6Passing

Unmodelled relatives

Relatives the calculator deliberately does not model (nephews, cousins, grandchildren through daughters, distant kindred): they must never change the numbers, only add clear guidance.

5 tests · src/lib/inheritance.unaccounted.test.ts

Test caseExpected resultActual result
Empty selection produces no warningNo unaccounted entriesPassing
Results are identical with and without otherRelatives setSame shares, same rule, same net whether or not unmodelled relatives are selectedPassing
Unaccounted lists the selected relatives with explanationsEach selected relative appears with its label and a non-empty explanationPassing
Unknown keys are ignoredAn unrecognised selection produces no unaccounted entriesPassing
Unaccounted is present even when no heirs can be computedRule “none” with the unmodelled relative still listedPassing

Numeral display

The display-only Arabic numeral preference: Eastern digits may be shown in the Arabic interface, but stored and calculated values always stay numeric, and English always uses Western digits.

3 tests · src/lib/numerals.test.ts

Test caseExpected resultActual result
Uses Eastern digits in Arabic when selected“$1,234.50 • 1/6 (12.50%)” renders with Eastern Arabic digitsPassing
Keeps Western digits in Arabic when selected and always in English“1/6” stays Western in Arabic-western and in English regardless of preferencePassing
Accepts either script for editable amounts without changing the stored number“١٢٣٤٫٥”, “1,234.5” and “۱۲۳۴٫۵” all parse to 1234.5Passing

Wizard flow & share links

Which questions the location step turns on, the step counter, and private share links. None of these change any Islamic-law share.

7 tests · src/lib/wizard-flow.test.ts

Test caseExpected resultActual result
Western country hides the wives count behind “More than one wife?”US/GB → count assumed, default one wifePassing
Country where the count is asked shows itSA/PK → wives count asked directlyPassing
No location asks every questionNo country → wives count askedPassing
Location label follows the modeAdminister: “Where did the deceased live?”; Plan: “Where do you live?”Passing
Location is its own early step; counter stays accurateStep 2 is Location; “Step X of N” never exceeds NPassing
New share links keep the case in #c=Link contains #c= and no ?c=Passing
Old ?c= links still load and convert to #c=/?lang=ar&c=… reopens the case and becomes /?lang=ar#c=…Passing

Results guidance (debts, mahr, beneficiary forms)

The guidance notes on the results screen: the unpaid-mahr debt hint, the debts-exceed-estate message, and the beneficiary-forms card. None of these change any Islamic-law share.

5 tests · src/lib/results-notes.test.ts

Test caseExpected resultActual result
Calculations are unchanged for an existing caseWife 1/8 (30,000), son 7/8 (210,000) on a 240,000 estatePassing
Mahr line shows for a male deceased with a wife and debts above zeroNote shownPassing
Mahr line hidden for a female deceased, no spouse, or no debtsNote hidden in all three casesPassing
Debts above the gross estate: message shown, net 0, no amountsMessage shown; net 0; every heir amount 0; hidden when debts are below the estatePassing
Beneficiary card appears in Plan mode only and hides once dismissedShown in Plan, hidden in Administer, hidden after dismissingPassing

Asset division tool (Administer mode)

The optional 'Divide the actual assets' tool. It uses the amounts from the results and never recomputes shares; items stay in the browser only.

20 tests · src/lib/asset-division.test.ts

Test caseExpected resultActual result
House to son, car and cash held in proportion (gross 800)Son receives 775 (+75), wife 25 (−75); son pays wife 75.00Passing
Debts 200: house to son, cash 400 sold or set asideSon −100, wife −100, estate cash +200; estate cash pays son 100 and wife 100Passing
Items totaling 900 against an estate of 1000 with no deductionsUnreconciled amount of 100 against the net estatePassing
Button hidden in Plan mode, with a treasury row, and with the provisional flagHidden; 'not available' line for treasury and provisional casesPassing
Nothing from the tool appears in share link or share textNo item names or division wording in eitherPassing
Three heirs with a value not divisible by threePayments total exactly, to the centPassing
Zero estate cash is omitted from the displayed partiesCash stays in settlement arithmetic but is hidden from the displayPassing
Estate cash with debts, costs, bequest, or assigned itemsCash party is displayed when entitled or receiving an amount above zeroPassing
Estate pays heirs and retains debt fundsThe estate pays Wife $100.00 and Son $100.00; $200.00 remains for debts, funeral costs and any bequest; debts note shownPassing
No-debts case hides leftover and debt guidanceNo estate-cash leftover line or debt notePassing
Reconciles against the net estate (estate 1000, debts 200, items 800 in proportion)Left to divide 800, difference 0; 200 of debts flagged as not yet coveredPassing
PDF viewer wording'View PDF' and 'Back to the division tool' present; every division string bilingualPassing
Debts line covered, under and overExactly 200 assigned: no message, no payments; 300 assigned: 100 more than neededPassing
'Already paid' box ticked, only remaining 800 listedDifference 0, no coverage message, debts line hiddenPassing
Custom split by percent and amount, and an invalid total50/50 settles; 70/30 amounts: one heir pays the other 20; 80% split flagged and the unassigned 20% held in proportion; negative or over-value entries flaggedPassing
Prefill from itemized assets ($700,000, debts and funeral $50,000, spouse, son, daughter)One row per asset at the Islamic counted value, legal-title tag kept; $50,000 of cash to debts gives difference 0 and heirs exactly their shares; list changes keep assignmentsPassing
No itemized assetsStarts with one blank item added by handPassing
CurrencyAmounts show in the selected currency (€, £)Passing
Saved cases carry the distribution listList, assignments and 'already paid' box restored; older files open without a listPassing
Confirmed saved case replaces an open distributionVisible items, assignments and already-paid box refresh from the loaded case; older saves clear the former listPassing

After-a-death checklist

The practical checklist page. General guidance only; ticked steps stay in the browser and are never saved or shared.

7 tests · src/lib/after-death.test.ts

Test caseExpected resultActual result
Every heading and step has English and Arabic text7 groups, 20 steps, all bilingualPassing
Scholar icon marks religious-ruling stepsFuneral, bequest, and religious-obligation steps onlyPassing
'What to do next' link on resultsShown in Administer mode, hidden in Plan modePassing
Local notes follow the chosen countryCountry's existing notes shown; prompt shown when none is setPassing
Back link with a calculation heldReads 'Back to calculated shares' and reopens the results, keeping the languagePassing
Back link with no calculation heldReads 'Raashid calculator' and opens the calculator startPassing
Start over clears the remembered caseChecklist resets to the no-calculation state after Start overPassing

Attorney worksheet (Plan mode)

The optional worksheet for your attorney. Answers stay in browser memory for the session and never reach the URL, share links, share text or the case PDF.

8 tests · src/lib/worksheet.test.ts

Test caseExpected resultActual result
Results callouts by modeWorksheet callout in Plan mode only; 'What to do next' in Administer mode onlyPassing
Back link and buttons follow the calculation in memoryPlan: 'Back to your results'; none: 'Raashid calculator'; Administer: note pointing to After a deathPassing
Answers survive navigation, cleared on reloadSaved answers return after visiting results; a fresh load starts emptyPassing
One-third bequest warningWarning above one third of the net estate (or 33.33% without a calculation); heir note text presentPassing
Skip and the children questionSkip moves on from every screen; 'No' skips the guardian screenPassing
Worksheet answers stay privateNothing entered appears in the share linkPassing
Printout text and funeral helperClosing text, no-schedule note and funeral helper present; every string bilingualPassing
Percent bequests and the PDF viewer wordingPercentage explained as a share of the net estate; 'View PDF' and 'Back to your worksheet' present in both languagesPassing

Leaving more to one heir

The educational page on gifts, debts and bequests to one heir. It collects no data and changes no calculation.

7 tests · src/lib/one-heir.test.ts

Test caseExpected resultActual result
Seven items, statuses, legend and open questions7 bilingual items (3 valid, 3 not permitted, 1 open); 6 open questionsPassing
Worked example figuresWife $37,500 + $200,000 = $237,500, son $262,500; husband $50,000, son $150,000, husband left $350,000Passing
Only listed sourcesExactly S1–S13 from the approved sites; every cited source existsPassing
Back link'← Back' after a same-site page; '← Raashid home' otherwisePassing
Debts tip link'See Leaving more to one heir.' in English and ArabicPassing
Spouse-or-heir card is a bulleted listTitle '…spouse or another heir'; 5 bilingual bullets; old paragraph wording gonePassing
Sources show titles, never raw addressesEach of S1–S13 shows a title or reference numbers plus a site label (Quran.com, Sunnah.com, Islam Q&A…); no 'http' in the visible textPassing

Family tree view

The optional Family tree screen writes the same answers as the question steps. These tests rebuild many family set-ups through the tree, check its own copies of step rules, keep names out of share links, and confirm the results-page what-if view never touches the real answers.

16 tests · src/lib/family-tree-parity.test.ts

Test caseExpected resultActual result
Tree path gives identical answers and results to the question path27 family set-ups rebuilt with tree actions match exactlyPassing
Wives one to four; one assumed in a monogamous country9 → 4; US assumes one wife until askedPassing
Female deceased shows a husbandHusband 1/2; wives names refusedPassing
Mother suppresses grandmothersMaternal grandmother shown as blockedPassing
Maternal siblings are one combined countThree maternal siblings share 1/3Passing
Shares that differ by school are flaggedGrandfather with brothers flagged; wife alone notPassing
Names are trimmed and cappedFewer sons drops extra names; 30 characters maxPassing
Share links never carry names#z=, #c= and the after-death snapshot contain no namesPassing
Names kept in saved files and draftsSaved file and session draft keep the namesPassing
Name labels and PDF print modes"Zayd (Son 1)"; Arabic uses Amiri; unsupported scripts fall backPassing
Old files, links and drafts still openNo names or view choice neededPassing
Step order on each pathTree path has 5 steps; switching maps to the matching stepPassing
What-if edits never reach the real answersReal answers, link and draft unchanged; reopening starts freshPassing
Tree amounts match the results tableEqual to the cent for every set-upPassing
Tree PDF what-if labelShown only when the tree differsPassing
Every family field is covered by the treeFails if a family field is added without tree supportPassing

These tests verify the arithmetic and rules of the calculator. They are not a substitute for scholarly review of a specific estate; rare cases flagged during use should always be taken to a qualified Islamic scholar. If you believe a result is wrong, please tell us through the feedback form so we can investigate.