Skip to content

Commit 1273ecc

Browse files
committed
test(core): fix appscript fixture; move app tests to correct folder
1 parent c29ada9 commit 1273ecc

File tree

5 files changed

+35
-6
lines changed

5 files changed

+35
-6
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Copyright 2023 Giuseppe De Palma, Matteo Trentin
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
- tag_a:
16+
- workers:
17+
- worker1
18+
- worker2
19+
strategy: best-first
20+
21+
- tag_b:
22+
- workers:
23+
- worker1
24+
- worker2
25+
- worker3
26+
strategy: random

core/test/support/fixtures/app_scripts_fixtures.ex

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,21 @@ defmodule Core.APPScriptsFixtures do
1616
This module defines test helpers for creating
1717
entities via the `Core.APPScripts` context.
1818
"""
19+
alias Core.Domain.APPScripts
20+
alias Core.Domain.Policies.Parsers.APP
1921

2022
@doc """
2123
Generate a app_script.
2224
"""
23-
def app_script_fixture(attrs \\ %{}) do
25+
def app_script_fixture(_attrs \\ %{}) do
26+
script = File.read!("test/support/fixtures/APP/example.yml")
27+
{:ok, parsed_script} = APP.parse(script)
28+
2429
{:ok, app_script} =
25-
attrs
26-
|> Enum.into(%{
27-
name: "some name",
28-
script: "some script"
30+
APPScripts.create_app_script(%{
31+
name: "examplescript",
32+
script: parsed_script |> APP.to_map()
2933
})
30-
|> Core.Domain.APPScripts.create_app_script()
3134

3235
app_script
3336
end

0 commit comments

Comments
 (0)