blob: 5cecb3726e85d4f893eb6ec98959439803bbfe97 [file] [log] [blame]
// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import * as Common from './common.js';
const StringOutputStream = Common.StringOutputStream.StringOutputStream;
describe('StringOutputStream', () => {
it('can be instantiated without issues', () => {
const stream = new StringOutputStream();
assert.strictEqual(stream.data(), '', 'data is not empty');
});
it('can be closed without issues', async () => {
const stream = new StringOutputStream();
await stream.close();
assert.strictEqual(stream.data(), '', 'data is not empty');
});
it('can be written to without issues', async () => {
const stream = new StringOutputStream();
await stream.write('Hello');
await stream.write(' ');
await stream.write('world!');
await stream.close();
assert.strictEqual(stream.data(), 'Hello world!', 'data does not match what was written');
});
});