Funktionen: News im Abo-Modell in Einrichtung ohne "Aktivieren (ohne Zahlung)" (Abschlussprüfung W2)
Das Portal antwortet darauf immer mit 409 bereits_eingeschaltet. Erkannt wird das Abo-Modell am Marker unlockedBy (abo, projekt) der Funktion; bei fehlendem Ticket steht "Ticket nachlegen" an der Stelle. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
8685411a93
commit
f11fd0bb25
3 files changed
+80
-3
No files matched your search
@@ -9,6 +9,7 @@ const {
|
||||
AKTION_LABEL,
|
||||
funktionOf,
|
||||
aktionen,
|
||||
aboModellFunktion,
|
||||
mergeFunktion,
|
||||
siteKeyOf,
|
||||
abgeschaltetText,
|
||||
@@ -59,6 +60,7 @@ test('FUNKTIONEN: News, Terminplaner, Webshop und Öffnungszeiten live (in diese
|
||||
bestaetigen: {
|
||||
activate: 'News ohne Zahlung aktivieren?',
|
||||
disable: 'News abschalten? Die Website zeigt dann keine Beiträge mehr.',
|
||||
ticket: 'Fehlendes Einrichtungs-Ticket neu anlegen?',
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -168,6 +170,69 @@ test('aktionen: News ignoriert ticketMissing in jedem Zustand', () => {
|
||||
}
|
||||
})
|
||||
|
||||
test('aboModellFunktion: nur Funktionen, die das Abo-Modell eingeschaltet hat (unlockedBy "abo" oder "projekt")', () => {
|
||||
assert.equal(aboModellFunktion({ state: 'setup', unlockedBy: 'abo' }), true)
|
||||
assert.equal(aboModellFunktion({ state: 'setup', unlockedBy: 'projekt' }), true)
|
||||
for (const unlockedBy of ['kauf', 'team', null, undefined, '', 'Abo', 'ABO', ' abo', 'projekt ', 5, true, ['abo']]) {
|
||||
assert.equal(aboModellFunktion({ state: 'setup', unlockedBy }), false, String(unlockedBy))
|
||||
}
|
||||
for (const feature of [undefined, null, {}, 'abo', 5]) assert.equal(aboModellFunktion(feature), false, String(feature))
|
||||
})
|
||||
|
||||
test('aktionen W2: News im Abo-Modell in "Einrichtung" bietet kein Aktivieren (der Server antwortet 409 bereits_eingeschaltet), nur Abschalten', () => {
|
||||
assert.deepEqual(aktionen('setup', 'news', { aboModell: true }), ['disable'])
|
||||
assert.deepEqual(aktionen('setup', undefined, { aboModell: true }), ['disable'], 'ohne Schlüssel wie News')
|
||||
assert.deepEqual(aktionen('setup', 'news', { aboModell: true, hindernis: 'kein_abo' }), ['disable'])
|
||||
})
|
||||
|
||||
test('aktionen W2: fehlt das Einrichtungs-Ticket, steht an der Stelle von Aktivieren "Ticket nachlegen" (dafür gibt es die Route, Aktivieren nicht)', () => {
|
||||
assert.deepEqual(aktionen('setup', 'news', { aboModell: true, ticketMissing: true }), ['ticket', 'disable'])
|
||||
assert.deepEqual(aktionen('setup', 'news', { aboModell: true, ticketMissing: false }), ['disable'])
|
||||
for (const action of aktionen('setup', 'news', { aboModell: true, ticketMissing: true })) {
|
||||
assert.ok(FUNKTIONEN.find((f) => f.key === 'news').bestaetigen[action], `Text für ${action}`)
|
||||
}
|
||||
assert.equal(FUNKTIONEN.find((f) => f.key === 'news').bestaetigen.ticket, 'Fehlendes Einrichtungs-Ticket neu anlegen?')
|
||||
})
|
||||
|
||||
test('aktionen W2: außerhalb von "Einrichtung" und ohne Abo-Modell bleibt alles wie bisher', () => {
|
||||
// andere Zustände: das Abo-Modell ändert nichts
|
||||
for (const state of ['off', 'ordered', 'active', 'disabled', undefined]) {
|
||||
for (const ticketMissing of [false, true]) {
|
||||
assert.deepEqual(aktionen(state, 'news', { aboModell: true, ticketMissing }), aktionen(state, 'news'), String(state))
|
||||
}
|
||||
}
|
||||
// ohne Abo-Modell (Kauf, Team, altes Portal ohne unlockedBy): Aktivieren in "Einrichtung" bleibt, ticketMissing wird ignoriert
|
||||
assert.deepEqual(aktionen('setup', 'news', { aboModell: false }), ['activate', 'disable'])
|
||||
assert.deepEqual(aktionen('setup', 'news', { aboModell: false, ticketMissing: true }), ['activate', 'disable'])
|
||||
assert.deepEqual(aktionen('setup', 'news', {}), ['activate', 'disable'])
|
||||
assert.deepEqual(aktionen('setup', 'news', { aboModell: 'abo' }), ['activate', 'disable'], 'nur ein echtes true zählt')
|
||||
// ticketbasierte Funktionen sind vom Abo-Modell unberührt (dort gibt es in "Einrichtung" nie Aktivieren)
|
||||
for (const key of ['termine', 'shop', 'zeiten', 'unterkunft']) {
|
||||
for (const state of ['off', 'ordered', 'setup', 'active', 'disabled', undefined]) {
|
||||
for (const ticketMissing of [false, true]) {
|
||||
assert.deepEqual(aktionen(state, key, { aboModell: true, ticketMissing }), aktionen(state, key, { ticketMissing }), `${key} ${String(state)}`)
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
test('aktionen: jede angebotene Aktion hat Beschriftung und Bestätigungstext (alle Funktionen, Zustände und Optionen, auch im Abo-Modell)', () => {
|
||||
for (const f of FUNKTIONEN) {
|
||||
for (const state of ['off', 'ordered', 'setup', 'active', 'disabled', undefined]) {
|
||||
for (const aboModell of [false, true]) {
|
||||
for (const ticketMissing of [false, true]) {
|
||||
for (const hindernis of [null, 'zeiten_fehlen']) {
|
||||
for (const action of aktionen(state, f.key, { aboModell, ticketMissing, hindernis })) {
|
||||
assert.ok(AKTION_LABEL[action], `${f.key} ${String(state)}: Beschriftung ${action}`)
|
||||
assert.ok(f.bestaetigen[action], `${f.key} ${String(state)}: Text ${action}`)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
test('aktionen: Terminplaner – bestellt nur Abschalten (kein Aktivieren ohne Zahlung), Einrichtung mit Abnahme', () => {
|
||||
assert.deepEqual(aktionen('off', 'termine'), ['activate'])
|
||||
assert.deepEqual(aktionen('ordered', 'termine'), ['disable'], 'Aktivieren würde eine spätere Zahlung im Portal verschlucken')
|
||||
|
||||
Reference in new issue
Block a user