    @Test
    public void writesCorrectHostPrefix() {

        GenerationContext mockContext = new GenerationContext();
        mockContext.setSymbolProvider(new MockProvider());
        TypeScriptWriter writer = new TypeScriptWriter("foo");
        mockContext.setWriter(writer);

        Model model = Model.assembler()
                .addImport(getClass().getResource("endpoint-trait.smithy"))
                .assemble()
                .unwrap();

        mockContext.setModel(model);

        OperationShape operation = (OperationShape) model.expectShape(ShapeId.from("smithy.example#GetFoo"));
        HttpProtocolGeneratorUtils.writeHostPrefix(mockContext, operation);
        assertThat(writer.toString(), containsString("let { hostname: resolvedHostname } = await context.endpoint();"));
        assertThat(writer.toString(), containsString("if (context.disableHostPrefix !== true) {"));
        assertThat(writer.toString(), containsString("resolvedHostname = \"{foo}.data.\" + resolvedHostname;"));
        assertThat(writer.toString(), containsString("resolvedHostname = resolvedHostname.replace(\"{foo}\", input.foo!)"));
        assertThat(writer.toString(), containsString("if (!__isValidHostname(resolvedHostname)) {"));
        assertThat(writer.toString(), containsString(
                "throw new Error(\"ValidationError: prefixed hostname must be hostname compatible."));
    }