Skip to content

Test shop ​

The tests run against a shop: pkg/internal/mock generates deterministic GA4 traffic from a shop with two departments, women's fashion and home decoration. Personas with a hidden taste browse it, open and buy what they like, request by request, while the shop ranks every listing with the personalization vector the affinity still distills from what they did.

It is internal: test fixtures for this module, free to change, not an API. But it is what the exhibits and these guides use to show the packages at work, so it is split the way a real shop is, and these pages follow that split.

Packages ​

PackageWhat it isGuideExhibit
mock/tastethe dimensions taste is described inCatalog
mock/catalogwhat the shop sells: products, category tree, weights, ScoreCatalogon the guide page
mock/personathe four shoppers' tastes, and how a shopper picksPersonason the guide page
mock/shoplistings, ranked by a profile, and the GA4 events they reportShopShop
mock/journeysa persona taken through the shop: a visit, or a month of themJourneysJourneys
mock/wirethe Measurement Protocol envelope, and a visit as requestsEvents on the wire
mockthe fixtures in testdata and the images, built from all of the aboveEvents on the wire

Who knows what ​

The arrows are imports (wire needs nothing but sesamy-go), and they carry the shop's one rule: the shop never sees a persona. shop imports the catalog and nothing that knows a shopper's taste. It ranks every listing by a shop.Profile, the vector an affinity still (pkg/distillery/stills/affinity) distills from the shopper's events so far. Only journeys brings a persona and the shop together. The persona decides what gets picked, and the shop has to learn it from the picks.

In a test ​

go
import (
    "github.com/foomo/schaumamoi/pkg/distillery/stills/affinity"
    "github.com/foomo/schaumamoi/pkg/internal/mock/persona"
    "github.com/foomo/schaumamoi/pkg/internal/mock/journeys"
)

visit := journeys.Buying(persona.Sofia)                // wire.Session: one request per event
month := journeys.History(journeys.Month(persona.Kate)) // []wire.Session, 7 visits

still := affinity.New(nil) // the shopper's still
for _, request := range visit {
    still.Feed(affinity.Envelope(request), request.Events...) // each request as sent
}