mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-07-07 21:34:21 +00:00
test(sub): align identity-token test with first-link-only EMAIL
876d55f2 made {{EMAIL}}/{{USERNAME}} appear on the first sub-body link
only, but TestIdentityTokensEverywhere still asserted the email survived
on every repeat body link, breaking the go-test and race CI jobs. Update
it to assert the repeat body link drops the identity token while the
display/QR remark keeps it; the first-link case is covered by
TestEmailOnFirstLinkOnly.
This commit is contained in:
@@ -361,7 +361,7 @@ func TestConnectionTokensDisplayContextUnchanged(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestIdentityTokensEverywhere(t *testing.T) {
|
||||
func TestIdentityTokenBodyVsDisplay(t *testing.T) {
|
||||
const tmpl = "{{INBOUND}}|📊{{TRAFFIC_LEFT}}|{{EMAIL}}"
|
||||
inbound := &model.Inbound{
|
||||
Remark: "DE",
|
||||
@@ -373,8 +373,8 @@ func TestIdentityTokensEverywhere(t *testing.T) {
|
||||
|
||||
body := &SubService{remarkTemplate: tmpl, subscriptionBody: true, usageShown: map[string]bool{}}
|
||||
_ = body.genTemplatedRemark(inbound, client, "", "ws") // first link consumes the usage block
|
||||
if second := body.genTemplatedRemark(inbound, client, "", "ws"); !strings.Contains(second, "john@x") {
|
||||
t.Fatalf("repeat body link %q must keep the identity token", second)
|
||||
if second := body.genTemplatedRemark(inbound, client, "", "ws"); strings.Contains(second, "john@x") {
|
||||
t.Fatalf("repeat body link %q must drop the identity token", second)
|
||||
}
|
||||
|
||||
display := &SubService{remarkTemplate: tmpl, subscriptionBody: false}
|
||||
|
||||
Reference in New Issue
Block a user