Skip to content

Commit cb7abe6

Browse files
committed
Add test for dev option
1 parent 23e1c42 commit cb7abe6

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

Diff for: test/migration_generator_test.exs

+40
Original file line numberDiff line numberDiff line change
@@ -1250,6 +1250,46 @@ defmodule AshPostgres.MigrationGeneratorTest do
12501250
end
12511251
end
12521252

1253+
describe "--dev option" do
1254+
setup do
1255+
defposts do
1256+
attributes do
1257+
uuid_primary_key(:id)
1258+
attribute(:title, :string, public?: true)
1259+
end
1260+
end
1261+
1262+
defdomain([Post])
1263+
1264+
[domain: Domain]
1265+
end
1266+
1267+
test "generates dev migration", %{domain: domain} do
1268+
AshPostgres.MigrationGenerator.generate(domain,
1269+
snapshot_path: "test_snapshots_path",
1270+
migration_path: "test_migration_path",
1271+
dev: true
1272+
)
1273+
1274+
assert [file] =
1275+
Path.wildcard("test_migration_path/**/*_migrate_resources*.exs")
1276+
|> Enum.reject(&String.contains?(&1, "extensions"))
1277+
1278+
assert String.contains?(file, "_dev.exs")
1279+
1280+
AshPostgres.MigrationGenerator.generate(domain,
1281+
snapshot_path: "test_snapshots_path",
1282+
migration_path: "test_migration_path"
1283+
)
1284+
1285+
assert [file] =
1286+
Path.wildcard("test_migration_path/**/*_migrate_resources*.exs")
1287+
|> Enum.reject(&String.contains?(&1, "extensions"))
1288+
1289+
refute String.contains?(file, "_dev.exs")
1290+
end
1291+
end
1292+
12531293
describe "references" do
12541294
setup do
12551295
on_exit(fn ->

0 commit comments

Comments
 (0)