Complete Phase 12 grammar module
This commit is contained in:
@@ -66,7 +66,7 @@ func TestUnsupportedUnknownModuleKeyFailsCleanly(t *testing.T) {
|
||||
|
||||
func TestRecognizedButUnimplementedModuleKeyFailsCleanly(t *testing.T) {
|
||||
factory := NewFactory(Dependencies{})
|
||||
for _, key := range []string{ModuleKeyGlossary, ModuleKeyHomophones, ModuleKeySpokenWord, ModuleKeyGrammar} {
|
||||
for _, key := range []string{ModuleKeyGlossary, ModuleKeyHomophones, ModuleKeySpokenWord} {
|
||||
t.Run(key, func(t *testing.T) {
|
||||
_, err := factory.ModuleForSpec(contracts.ModuleRunSpec{ModuleKey: key, InstanceName: key})
|
||||
if err == nil {
|
||||
@@ -84,6 +84,17 @@ func TestRecognizedButUnimplementedModuleKeyFailsCleanly(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestGrammarIsRegisteredAndConstructibleByDefault(t *testing.T) {
|
||||
factory := NewFactory(Dependencies{})
|
||||
module, err := factory.ModuleForSpec(contracts.ModuleRunSpec{ModuleKey: ModuleKeyGrammar, InstanceName: ModuleKeyGrammar})
|
||||
if err != nil {
|
||||
t.Fatalf("ModuleForSpec error: %v", err)
|
||||
}
|
||||
if module.Key() != ModuleKeyGrammar {
|
||||
t.Fatalf("expected grammar module key, got %q", module.Key())
|
||||
}
|
||||
}
|
||||
|
||||
func TestRegisterConstructorAndConstruct(t *testing.T) {
|
||||
factory := NewFactory(Dependencies{})
|
||||
if err := factory.RegisterConstructor(ModuleKeyGlossary, func(ctx context.Context, req ConstructRequest) (contracts.TranscriptModule, error) {
|
||||
|
||||
Reference in New Issue
Block a user