mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-06-23 02:48:26 +00:00
Update scalafmt settings
This commit is contained in:
@ -26,7 +26,7 @@ trait StoreFixture extends CatsEffectFunFixtures { self: CatsEffectSuite =>
|
||||
for {
|
||||
ds <- StoreFixture.dataSource(cfg)
|
||||
xa <- StoreFixture.makeXA(ds)
|
||||
_ <- Resource.eval(FlywayMigrate.run[IO](cfg))
|
||||
_ <- Resource.eval(FlywayMigrate.run[IO](cfg))
|
||||
} yield xa
|
||||
}
|
||||
|
||||
@ -34,7 +34,7 @@ trait StoreFixture extends CatsEffectFunFixtures { self: CatsEffectSuite =>
|
||||
val cfg = StoreFixture.memoryDB("test")
|
||||
for {
|
||||
store <- StoreFixture.store(cfg)
|
||||
_ <- Resource.eval(store.migrate)
|
||||
_ <- Resource.eval(store.migrate)
|
||||
} yield store
|
||||
}
|
||||
}
|
||||
|
@ -51,14 +51,14 @@ class ItemQueryGeneratorTest extends FunSuite {
|
||||
}
|
||||
|
||||
test("!conc:*") {
|
||||
val q = ItemQueryParser.parseUnsafe("!conc:*")
|
||||
val cond = ItemQueryGenerator(now, tables, Ident.unsafe("coll"))(q)
|
||||
val q = ItemQueryParser.parseUnsafe("!conc:*")
|
||||
val cond = ItemQueryGenerator(now, tables, Ident.unsafe("coll"))(q)
|
||||
val expect = not(tables.concPers.name.like("%") || tables.concEquip.name.like("%"))
|
||||
assertEquals(cond, expect)
|
||||
}
|
||||
|
||||
test("attach.id with wildcard") {
|
||||
val q = ItemQueryParser.parseUnsafe("attach.id=abcde*")
|
||||
val q = ItemQueryParser.parseUnsafe("attach.id=abcde*")
|
||||
val cond = ItemQueryGenerator(now, tables, Ident.unsafe("coll"))(q)
|
||||
val expect = tables.item.id.in(
|
||||
Select(
|
||||
@ -72,7 +72,7 @@ class ItemQueryGeneratorTest extends FunSuite {
|
||||
}
|
||||
|
||||
test("attach.id with equals") {
|
||||
val q = ItemQueryParser.parseUnsafe("attach.id=abcde")
|
||||
val q = ItemQueryParser.parseUnsafe("attach.id=abcde")
|
||||
val cond = ItemQueryGenerator(now, tables, Ident.unsafe("coll"))(q)
|
||||
val expect = tables.item.id.in(
|
||||
Select(
|
||||
|
@ -16,7 +16,7 @@ import munit.FunSuite
|
||||
class H2MigrateTest extends FunSuite {
|
||||
|
||||
test("h2 empty schema migration") {
|
||||
val jdbc = StoreFixture.memoryDB("h2test")
|
||||
val jdbc = StoreFixture.memoryDB("h2test")
|
||||
val result = FlywayMigrate.run[IO](jdbc).unsafeRunSync()
|
||||
assert(result.migrationsExecuted > 0)
|
||||
}
|
||||
|
@ -14,8 +14,8 @@ import munit._
|
||||
class QueryBuilderTest extends FunSuite {
|
||||
|
||||
test("simple") {
|
||||
val c = CourseRecord.as("c")
|
||||
val owner = PersonRecord.as("p1")
|
||||
val c = CourseRecord.as("c")
|
||||
val owner = PersonRecord.as("p1")
|
||||
val lecturer = PersonRecord.as("p2")
|
||||
|
||||
val proj = select(c.all, owner.all, lecturer.all)
|
||||
|
@ -15,8 +15,8 @@ import munit._
|
||||
class SelectBuilderTest extends FunSuite {
|
||||
|
||||
test("basic fragment") {
|
||||
val c = CourseRecord.as("c")
|
||||
val owner = PersonRecord.as("o")
|
||||
val c = CourseRecord.as("c")
|
||||
val owner = PersonRecord.as("o")
|
||||
val lecturer = PersonRecord.as("l")
|
||||
|
||||
val proj = select(c.all)
|
||||
@ -28,7 +28,7 @@ class SelectBuilderTest extends FunSuite {
|
||||
owner.name === "Harald"
|
||||
)
|
||||
|
||||
val q = Select(proj, table, cond)
|
||||
val q = Select(proj, table, cond)
|
||||
val frag = SelectBuilder(q)
|
||||
assertEquals(
|
||||
frag.toString,
|
||||
|
@ -24,11 +24,11 @@ object CourseRecord {
|
||||
|
||||
override val tableName = "course"
|
||||
|
||||
val id = Column[Long]("id", this)
|
||||
val name = Column[String]("name", this)
|
||||
val ownerId = Column[Long]("owner_id", this)
|
||||
val id = Column[Long]("id", this)
|
||||
val name = Column[String]("name", this)
|
||||
val ownerId = Column[Long]("owner_id", this)
|
||||
val lecturerId = Column[Long]("lecturer_id", this)
|
||||
val lessons = Column[Int]("lessons", this)
|
||||
val lessons = Column[Int]("lessons", this)
|
||||
|
||||
val all = NonEmptyList.of[Column[_]](id, name, ownerId, lecturerId, lessons)
|
||||
}
|
||||
|
@ -19,8 +19,8 @@ object PersonRecord {
|
||||
|
||||
val tableName = "person"
|
||||
|
||||
val id = Column[Long]("id", this)
|
||||
val name = Column[String]("name", this)
|
||||
val id = Column[Long]("id", this)
|
||||
val name = Column[String]("name", this)
|
||||
val created = Column[Timestamp]("created", this)
|
||||
|
||||
val all = NonEmptyList.of[Column[_]](id, name, created)
|
||||
|
@ -22,11 +22,11 @@ import munit._
|
||||
class QJobTest extends CatsEffectSuite with StoreFixture {
|
||||
private[this] val c = new AtomicLong(0)
|
||||
|
||||
private val worker = Ident.unsafe("joex1")
|
||||
private val worker = Ident.unsafe("joex1")
|
||||
private val initialPause = Duration.seconds(5)
|
||||
private val nowTs = Timestamp(Instant.parse("2021-06-26T14:54:00Z"))
|
||||
private val group1 = Ident.unsafe("group1")
|
||||
private val group2 = Ident.unsafe("group2")
|
||||
private val nowTs = Timestamp(Instant.parse("2021-06-26T14:54:00Z"))
|
||||
private val group1 = Ident.unsafe("group1")
|
||||
private val group2 = Ident.unsafe("group2")
|
||||
|
||||
def createJob(group: Ident): RJob =
|
||||
RJob.newJob[Unit](
|
||||
@ -44,7 +44,7 @@ class QJobTest extends CatsEffectSuite with StoreFixture {
|
||||
xa.test("set group must insert or update") { tx =>
|
||||
val res =
|
||||
for {
|
||||
_ <- RJobGroupUse.setGroup(RJobGroupUse(group1, worker)).transact(tx)
|
||||
_ <- RJobGroupUse.setGroup(RJobGroupUse(group1, worker)).transact(tx)
|
||||
res <- RJobGroupUse.findGroup(worker).transact(tx)
|
||||
} yield res
|
||||
|
||||
@ -57,7 +57,7 @@ class QJobTest extends CatsEffectSuite with StoreFixture {
|
||||
.map(createJob)
|
||||
.map(RJob.insert)
|
||||
.traverse(_.transact(tx))
|
||||
_ <- RJobGroupUse.deleteAll.transact(tx)
|
||||
_ <- RJobGroupUse.deleteAll.transact(tx)
|
||||
next <- QJob.selectNextGroup(worker, nowTs, initialPause).transact(tx)
|
||||
} yield next
|
||||
|
||||
@ -70,8 +70,8 @@ class QJobTest extends CatsEffectSuite with StoreFixture {
|
||||
.map(createJob)
|
||||
.map(RJob.insert)
|
||||
.traverse(_.transact(tx))
|
||||
_ <- RJobGroupUse.deleteAll.transact(tx)
|
||||
_ <- RJobGroupUse.setGroup(RJobGroupUse(group1, worker)).transact(tx)
|
||||
_ <- RJobGroupUse.deleteAll.transact(tx)
|
||||
_ <- RJobGroupUse.setGroup(RJobGroupUse(group1, worker)).transact(tx)
|
||||
next <- QJob.selectNextGroup(worker, nowTs, initialPause).transact(tx)
|
||||
} yield next
|
||||
|
||||
@ -84,8 +84,8 @@ class QJobTest extends CatsEffectSuite with StoreFixture {
|
||||
.map(createJob)
|
||||
.map(RJob.insert)
|
||||
.traverse(_.transact(tx))
|
||||
_ <- RJobGroupUse.deleteAll.transact(tx)
|
||||
_ <- RJobGroupUse.setGroup(RJobGroupUse(group2, worker)).transact(tx)
|
||||
_ <- RJobGroupUse.deleteAll.transact(tx)
|
||||
_ <- RJobGroupUse.setGroup(RJobGroupUse(group2, worker)).transact(tx)
|
||||
next <- QJob.selectNextGroup(worker, nowTs, initialPause).transact(tx)
|
||||
} yield next
|
||||
|
||||
|
Reference in New Issue
Block a user