/* This file is a part of @mdn/browser-compat-data * See LICENSE file for more information. */ import assert from 'node:assert/strict'; import { Logger } from '../utils.js'; import test from './test-mirror.js'; describe('test-mirror', () => { /** @type {Logger} */ let logger; beforeEach(() => { logger = new Logger('test', 'test'); }); it('should log error when data can be automatically mirrored', async () => { const supportData = { chrome: { version_added: '89', }, chrome_android: { version_added: '89', }, }; const category = 'api'; await test.check(logger, { data: { support: supportData }, path: { full: `${category}.Test`, category }, }); assert.equal(logger.messages.length, 1); assert.ok( logger.messages[0].message.includes('can be automatically mirrored'), ); assert.equal(logger.messages[0].fixable, true); }); describe('Mirroring', () => { beforeEach(async () => { await test.check(logger, { data: { support: { chrome: { version_added: '89', }, firefox: { version_added: '90', }, }, }, path: { full: 'webextensions.Test', category: 'webextensions', }, }); }); it('should not log any errors', () => { assert.equal(logger.messages.length, 0); }); }); it('should not log error when data cannot be automatically mirrored', async () => { const supportData = { chrome: { version_added: '89', }, firefox: { version_added: '90', }, }; const category = 'webextensions'; await test.check(logger, { data: { support: supportData }, path: { full: `${category}.Test`, category }, }); assert.equal(logger.messages.length, 0); }); });