Skip to content

Commit 2aedd34

Browse files
author
Dev-3
committed
test: pin the two server-choice states apart on one paint (#2946)
#2945 owns the damaged-file refusal and this card owns a valid file holding an address the validator refuses. The page test now asserts both directions in the same render: with a saved fact there is no refusal sentence, and on the refusal page there is no saved line.
1 parent 50a5a21 commit 2aedd34

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

‎plugins/social/test/social.test.js‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9456,9 +9456,15 @@ test('Settings → Bot Social page: shows server, source and status; the switch
94569456
test('#2946: Settings names a saved server the profile cannot use, and says nothing when none was saved', () => {
94579457
{
94589458
const { plugin, all, text } = clientPlugin([serverView({ saved: { address: 'http://not-allowed.example', problem: 'The address must start with https://' } }), null, null])
9459-
const row = nodeBy(all(plugin.SocialServerSettings(pageProps)), 'server-saved-unusable')
9459+
const nodes = all(plugin.SocialServerSettings(pageProps))
9460+
const row = nodeBy(nodes, 'server-saved-unusable')
94609461
assert.ok(row, 'the page names the saved server it could not use')
94619462
assert.equal(text(row), 'The server saved here (http://not-allowed.example) cannot be used: The address must start with https://. Using the profile default (https://a.test).')
9463+
// Same first paint, the other state on this panel (#2945): a damaged file refuses with its own
9464+
// whole sentence. This view has a saved fact, so that refusal must not be drawn beside it.
9465+
const paint = text(nodes[0])
9466+
assert.doesNotMatch(paint, /does not parse as JSON|cannot be read/)
9467+
assert.doesNotMatch(paint, /Social is not running:/)
94629468
}
94639469
{
94649470
// No saved file, no `saved` fact: the page says nothing extra.
@@ -9470,8 +9476,10 @@ test('#2946: Settings names a saved server the profile cannot use, and says noth
94709476
// draws the refusal and no saved-server line — the two states never draw together.
94719477
const { plugin, all, text } = clientPlugin([null, 'The Bot Social server chosen in Settings at ./flybot-social-server.json exists but does not parse as JSON.'])
94729478
const nodes = all(plugin.SocialServerSettings(pageProps))
9473-
assert.match(text(nodes[0]), /exists but does not parse as JSON/)
9479+
const paint = text(nodes[0])
9480+
assert.match(paint, /exists but does not parse as JSON/)
94749481
assert.equal(nodeBy(nodes, 'server-saved-unusable'), undefined)
9482+
assert.doesNotMatch(paint, /cannot be used|Using the profile default/)
94759483
}
94769484
})
94779485

0 commit comments

Comments
 (0)