package Ġcom . ait or . sample market . repository Ċ Ċ import Ġarrow . core . Either Ċ import Ġarrow . core . Option Ċ import Ġarrow . core . right Ċ import Ġarrow . core . some Ċ import Ġcom . ait or . sample market . Base Test Ċ import Ġcom . ait or . sample market . Discount M other . PRODUCT _ DIS COUNT Ċ import Ġcom . ait or . sample market . data . network . datasource . Network Discount DataSource Ċ import Ġcom . ait or . sample market . data . network . model . Network Discount Ċ import Ġcom . ait or . sample market . data . repository . Discount Repository Impl Ċ import Ġcom . ait or . sample market . domain . model . ApiError Ċ import Ġio . mock k . every Ċ import Ġio . mock k . mock k Ċ import Ġorg . junit . Assert . assertEquals Ċ import Ġorg . junit . Before Ċ import Ġorg . junit . Test Ċ Ċ class ĠDiscount Repository Test Ġ: ĠBaseTest () Ġ{ ĊĊĠĠĠ Ġprivate Ġval Ġfake Network Discount DataSource Ġ= Ġmock k < Network Discount DataSource >() ĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġdiscount Repository : ĠDiscount Repository Impl ĊĊĠĠĠ Ġ@ Before ĊĠĠĠ Ġfun Ġsetup () Ġ{ ĊĠĠĠĠĠĠĠ Ġdiscount Repository Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ Ġcom . ait or . sample market . data . repository . Discount Repository Impl ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġfake Network Discount DataSource ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` gets Ġa Ġcorrect Ġdiscount `() Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġexpected Discount Ġ= Ġgiven AD is count () ĊĠĠĠĠĠĠĠ Ġval Ġtest Discount Ġ= Ġdiscount Repository . fetch Dis counts () ĊĊĠĠĠĠĠĠĠ ĠassertEquals ( expected Discount . map Ġ{ Ġit . as Domain Model () Ġ}, Ġtest Discount ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġgiven AD is count (): ĠEither < ApiError , ĠNetwork Discount > Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġdiscount Ġ= ĠPRODUCT _ DIS COUNT . right () ĊĠĠĠĠĠĠĠ Ġevery Ġ{ Ġfake Network Discount DataSource . all Ġ} Ġreturns Ġdiscount ĊĠĠĠĠĠĠĠ Ġreturn Ġdiscount ĊĠĠĠ Ġ} Ċ }