/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import {Component, makeStateKey, NgModule, TransferState} from '@angular/core';
import {BrowserModule} from '@angular/platform-browser';
import {renderModule, ServerModule} from '@angular/platform-server';
describe('transfer_state', () => {
const defaultExpectedOutput =
'
Works!';
it('adds transfer script tag when using renderModule', async () => {
const STATE_KEY = makeStateKey('test');
@Component({selector: 'app', template: 'Works!'})
class TransferComponent {
constructor(private transferStore: TransferState) {
this.transferStore.set(STATE_KEY, 10);
}
}
@NgModule({
bootstrap: [TransferComponent],
declarations: [TransferComponent],
imports: [BrowserModule, ServerModule],
})
class TransferStoreModule {
}
const output = await renderModule(TransferStoreModule, {document: ''});
expect(output).toBe(defaultExpectedOutput);
});
it('cannot break out of