feat: add audited one-shot prepare gate
This commit is contained in:
@@ -8,6 +8,47 @@ namespace MBN_STOCK_WEBVIEW.LegacyBridge.Tests;
|
||||
|
||||
public sealed class LegacyPlayoutBridgeTests
|
||||
{
|
||||
private const string GateACapability =
|
||||
"0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF";
|
||||
|
||||
[Fact]
|
||||
public void GateAPrepare_ParsesOnlyExactUppercaseCapabilityShape()
|
||||
{
|
||||
Assert.True(LegacyBridgeProtocol.TryParseIntent(
|
||||
"{\"type\":\"gate-a-prepare\",\"payload\":{\"capability\":\"" +
|
||||
GateACapability + "\"}}",
|
||||
out var intent,
|
||||
out var error), error);
|
||||
|
||||
Assert.Equal(
|
||||
GateACapability,
|
||||
Assert.IsType<LegacyGateAPrepareIntent>(intent).Capability);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("")]
|
||||
[InlineData("0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef")]
|
||||
[InlineData("0123456789ABCDEF")]
|
||||
[InlineData("G123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF")]
|
||||
public void GateAPrepare_RejectsInvalidCapabilities(string capability)
|
||||
{
|
||||
Assert.False(LegacyBridgeProtocol.TryParseIntent(
|
||||
"{\"type\":\"gate-a-prepare\",\"payload\":{\"capability\":\"" +
|
||||
capability + "\"}}",
|
||||
out _,
|
||||
out _));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void GateAPrepare_RejectsExtraProperties()
|
||||
{
|
||||
Assert.False(LegacyBridgeProtocol.TryParseIntent(
|
||||
"{\"type\":\"gate-a-prepare\",\"payload\":{\"capability\":\"" +
|
||||
GateACapability + "\",\"retry\":false}}",
|
||||
out _,
|
||||
out _));
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("prepare-playout", LegacyOperatorPlayoutCommand.Prepare)]
|
||||
[InlineData("take-in", LegacyOperatorPlayoutCommand.TakeIn)]
|
||||
|
||||
Reference in New Issue
Block a user