import '@testing-library/jest-dom'
import pl from 'nodejs-polars'
import { create_csv_database, add_row, print_head, delete_row_by_key, save_db } from '../app/database'
import { create_models } from '../app/model'

describe('DATABASE', () => {
  it('DATA', () => {
    const fooSeries = pl.Series("foo", [1, 2, 3])

    let res = fooSeries.sum()

    console.log(res)

    let df = pl.readCSV("data/iris.csv")
  })

  it('create csv', () => {
    let res = create_csv_database('csv_db/x.csv', { "a_key": ['initial'], "a_value": [''] })
    print_head(res)
    delete_row_by_key(res, "initial", "a_key")

    add_row(res, { "a_key": ["x"], "a_value": ["y"] })
    print_head(res)

    save_db(res)

    delete_row_by_key(res, "x", "a_key")
    print_head(res)
  })

  it('creates pos model', () => {
    create_models()
  })
})
