<commit_before>! Copyright (C) 2009 <NAME>.
! See http://factorcode.org/license.txt for BSD license.
USING: db.tuples locals site-watcher site-watcher.db
site-watcher.private kernel db io.directories io.files.temp
continuations db.sqlite site-watcher.db.private ;
IN: site-watcher.tests

:: fake-sites ( -- seq )
    [
        account ensure-table
        site ensure-table
        watching-site ensure-table

        "<EMAIL>" insert-account
        "http://asdfasdfasdfasdfqwerqqq.com" insert-site drop
        "http://fark.com" insert-site drop

        "<EMAIL>" "http://asdfasdfasdfasdfqwerqqq.com" watch-site
        f <site> select-tuples
    ] with-sqlite-db ;
<commit_msg>Fix site-watcher tests<commit_after>! Copyright (C) 2009 <NAME>.
! See http://factorcode.org/license.txt for BSD license.
USING: db.tuples locals site-watcher site-watcher.db
site-watcher.private kernel db io.directories io.files.temp
continuations site-watcher.db.private db.sqlite
sequences tools.test ;
IN: site-watcher.tests

[ "site-watcher.db" temp-file delete-file ] ignore-errors

:: fake-sites ( -- seq )
    "site-watcher.db" temp-file <sqlite-db> [
        account ensure-table
        site ensure-table
        watching-site ensure-table

        "<EMAIL>" insert-account
        "http://asdfasdfasdfasdfqwerqqq.com" insert-site drop
        "http://fark.com" insert-site drop

        "<EMAIL>" "http://asdfasdfasdfasdfqwerqqq.com" watch-site
        f <site> select-tuples
    ] with-db ;

[ f ] [ fake-sites empty? ] unit-test
{'fraction_non_alphanumeric': 0.12680683311432325, 'fraction_numerical': 0.005256241787122208, 'mean_word_length': 2.9151670951156814, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 12, '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': '1680734', 'n_tokens_mistral': 524, 'n_tokens_neox': 513, 'n_words': 111}