blob: 9650f5a8ce0eb50a1f0dfcf5d3ba624af2310aaa [file] [edit]
// Copyright 2025 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import {assert} from 'chai';
import {describe, it} from 'mocha';
import {SnapshotTester} from './SnapshotTester.js';
describe('SnapshotTester', function() {
const snapshotTester = new SnapshotTester(this, import.meta);
it('example snapshot', function() {
snapshotTester.assert(this, 'hello world');
});
it('only one snapshot assert allowed', function() {
snapshotTester.assert(this, 'hello world 1');
try {
snapshotTester.assert(this, 'hello world 2');
assert.fail('Expected `snapshotTester.assert` to throw');
} catch (err) {
assert.strictEqual(err.message, 'sorry, currently only support 1 snapshot assertion per test');
}
});
});