<commit_before>const path = require('path');
const flatfile = require('flat-file-db');
const promisify = require('then-flat-file-db');
const test = require('micro-analytics-adapter-utils/unit-tests');

const db = promisify(
  flatfile.sync(path.resolve(process.cwd(), process.env.DB_NAME || 'views.db'))
);
const adapter = require('./index');

test({
  name: 'flat-file-db',
  modulePath: path.resolve(__dirname, './index.js'),
  beforeAll: () => {
    adapter.init({ dbName: 'views.db' });
  },
  beforeEach: () => {
    return db.clear();
  },
});<commit_msg>test: Use adapter clear in adapter-flat-file-db tests<commit_after>const path = require('path');
const test = require('micro-analytics-adapter-utils/unit-tests');

const adapter = require('./index');

test({
  name: 'flat-file-db',
  modulePath: path.resolve(__dirname, './index.js'),
  beforeAll: () => {
    adapter.init({ dbName: 'views.db' });
  },
  beforeEach: () => {
    return adapter.clear();
  },
});
{'fraction_non_alphanumeric': 0.20781893004115226, 'fraction_numerical': 0.0, 'mean_word_length': 4.288043478260869, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1350993', 'n_tokens_mistral': 324, 'n_tokens_neox': 321, 'n_words': 62}