Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: stop using internal Relude_* in tests #344

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions __tests__/Relude_Debounce_test.re
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
open Jest;
open Expect;

module Timer = Relude_Timer;
module Debounce = Relude_Debounce;
module Timer = Relude.Timer;
module Debounce = Relude.Debounce;

describe("Debounce", () => {
test("debounce (leading=false)", () => {
Expand Down Expand Up @@ -144,4 +144,4 @@ describe("Debounce", () => {
expect((runCount1, runCount2, runCount3, runCount4))
|> toEqual((0, 0, 1, 1));
});
});
});
2 changes: 1 addition & 1 deletion __tests__/Relude_Free_Applicative_test.re
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ let validateUser =
SchemaValidate.foldFree(User.schema);
};

describe("Relude_Free_Applicative", () => {
describe("Relude.Free_Applicative", () => {
test("validateUser success", () =>
expect(validateUser("Andy", "White", "101"))
|> toEqual(
Expand Down
2 changes: 1 addition & 1 deletion __tests__/Relude_Free_Monad_test.re
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ module StorageAPI = {
include StorageFWithKeyAndValue.FreeMonad.WithMonad(State.Monad);
};

describe("Relude_Free_Monad", () => {
describe("Relude.Free_Monad", () => {
describe("StorageAPI", () => {
test("StorageState interpreter", () => {
// This is our monadic program stored as our free monad
Expand Down
2 changes: 1 addition & 1 deletion __tests__/Relude_Function_test.re
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
open Jest;
open Expect;

module Function = Relude_Function;
module Function = Relude.Function;
module StringArgument = {
type t = string;
module Type: BsBastet.Interface.TYPE with type t = t = {
Expand Down
44 changes: 22 additions & 22 deletions __tests__/Relude_IO_test.re
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ describe("IO basics", () => {
|> IO.unsafeRunAsync(
fun
| Ok(ior) =>
onDone(expect(ior) |> toEqual(Relude_Ior_Type.Both(42, "a")))
onDone(expect(ior) |> toEqual(Relude.Ior_Type.Both(42, "a")))
| Error(_) => onDone(fail("Fail")),
)
);
Expand All @@ -179,7 +179,7 @@ describe("IO basics", () => {
|> IO.unsafeRunAsync(
fun
| Ok(ior) =>
onDone(expect(ior) |> toEqual(Relude_Ior_Type.This(42)))
onDone(expect(ior) |> toEqual(Relude.Ior_Type.This(42)))
| Error(_) => onDone(fail("Fail")),
)
);
Expand All @@ -189,7 +189,7 @@ describe("IO basics", () => {
|> IO.unsafeRunAsync(
fun
| Ok(ior) =>
onDone(expect(ior) |> toEqual(Relude_Ior_Type.That(99)))
onDone(expect(ior) |> toEqual(Relude.Ior_Type.That(99)))
| Error(_) => onDone(fail("Fail")),
)
);
Expand All @@ -206,9 +206,9 @@ describe("IO basics", () => {
testAsync("alignWith pure pure", onDone => {
let f =
fun
| Relude_Ior_Type.This(a) => a
| Relude_Ior_Type.That(b) => int_of_string(b)
| Relude_Ior_Type.Both(a, b) => a + int_of_string(b);
| Relude.Ior_Type.This(a) => a
| Relude.Ior_Type.That(b) => int_of_string(b)
| Relude.Ior_Type.Both(a, b) => a + int_of_string(b);
IO.alignWith(f, IO.pure(42), IO.pure("99"))
|> IO.unsafeRunAsync(
fun
Expand All @@ -220,9 +220,9 @@ describe("IO basics", () => {
testAsync("alignWith pure throw", onDone => {
let f =
fun
| Relude_Ior_Type.This(a) => a
| Relude_Ior_Type.That(b) => int_of_string(b)
| Relude_Ior_Type.Both(a, b) => a + int_of_string(b);
| Relude.Ior_Type.This(a) => a
| Relude.Ior_Type.That(b) => int_of_string(b)
| Relude.Ior_Type.Both(a, b) => a + int_of_string(b);
IO.alignWith(f, IO.pure(42), IO.throw("e2"))
|> IO.unsafeRunAsync(
fun
Expand All @@ -234,9 +234,9 @@ describe("IO basics", () => {
testAsync("alignWith throw pure", onDone => {
let f =
fun
| Relude_Ior_Type.This(a) => a
| Relude_Ior_Type.That(b) => int_of_string(b)
| Relude_Ior_Type.Both(a, b) => a + int_of_string(b);
| Relude.Ior_Type.This(a) => a
| Relude.Ior_Type.That(b) => int_of_string(b)
| Relude.Ior_Type.Both(a, b) => a + int_of_string(b);
IO.alignWith(f, IO.throw("e1"), IO.pure("99"))
|> IO.unsafeRunAsync(
fun
Expand All @@ -248,9 +248,9 @@ describe("IO basics", () => {
testAsync("alignWith throw throw", onDone => {
let f =
fun
| Relude_Ior_Type.This(a) => a
| Relude_Ior_Type.That(b) => int_of_string(b)
| Relude_Ior_Type.Both(a, b) => a + int_of_string(b);
| Relude.Ior_Type.This(a) => a
| Relude.Ior_Type.That(b) => int_of_string(b)
| Relude.Ior_Type.Both(a, b) => a + int_of_string(b);
IO.alignWith(f, IO.throw("e1"), IO.throw("e2"))
|> IO.unsafeRunAsync(
fun
Expand Down Expand Up @@ -1355,7 +1355,7 @@ describe("IO mapError", () => {

testAsync("throw mapError unsafeRunAsync", onDone =>
IO.throw("this is a test")
|> IO.mapError(msg => Relude_Js_Exn.make(msg))
|> IO.mapError(msg => Relude.Js_Exn.make(msg))
|> IO.unsafeRunAsync(
fun
| Ok(_a) => onDone(fail("Failed"))
Expand Down Expand Up @@ -3165,7 +3165,7 @@ describe("IO debounce", () => {
IO.unsafeRunAsync(
Result.fold(
_ => "IO should not have failed" |> fail |> onDone,
Relude_Option.foldLazy(ignore, () =>
Relude.Option.foldLazy(ignore, () =>
"IO should not have been run" |> fail |> onDone
),
),
Expand All @@ -3176,7 +3176,7 @@ describe("IO debounce", () => {
debouncedIO() |> checkNonRunIO;

debouncedIO()
|> IO.flatMap(Relude_Option.fold(IO.pure(None), debouncedIO))
|> IO.flatMap(Relude.Option.fold(IO.pure(None), debouncedIO))
|> checkNonRunIO;

debouncedIO()
Expand Down Expand Up @@ -3231,11 +3231,11 @@ describe("IO debounce", () => {
debouncedIO() |> IO.unsafeRunAsync(ignore);

debouncedIO()
|> IO.flatMap(Relude_Option.fold(IO.pure(None), debouncedIO))
|> IO.flatMap(Relude.Option.fold(IO.pure(None), debouncedIO))
|> IO.unsafeRunAsync(ignore);

debouncedIO()
|> IO.flatMap(Relude_Option.fold(IO.pure(None), debouncedIO))
|> IO.flatMap(Relude.Option.fold(IO.pure(None), debouncedIO))
|> IO.flatMap(_ => IO.delay(300))
|> IO.unsafeRunAsync(_ =>
(
Expand Down Expand Up @@ -3513,9 +3513,9 @@ describe("IO FS examples", () => {
>>= (_ => FS.IO.readFile(testFilePath))
>>= (
content =>
Relude_String.toNonWhitespace(content)
Relude.String.toNonWhitespace(content)
|> IO.fromOption(_ =>
Relude_Js_Exn.make("Failed to get non-empty file content")
Relude.Js_Exn.make("Failed to get non-empty file content")
)
)
>>= (content => IO.pure(expect(content) |> toEqual("IO Aff test")))
Expand Down
8 changes: 4 additions & 4 deletions __tests__/Relude_Identity_test.re
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
open Jest;
open Expect;

module Identity = Relude_Identity;
module Identity = Relude.Identity;

describe("Identity", () => {
test("pure", () =>
Expand Down Expand Up @@ -29,14 +29,14 @@ describe("Identity", () => {
);

test("show", () =>
expect(Identity.show((module Relude_Int.Show), 5)) |> toEqual("5")
expect(Identity.show((module Relude.Int.Show), 5)) |> toEqual("5")
);

test("eq true", () =>
expect(Identity.eq((module Relude_Int.Eq), 5, 5)) |> toEqual(true)
expect(Identity.eq((module Relude.Int.Eq), 5, 5)) |> toEqual(true)
);

test("eq false", () =>
expect(Identity.eq((module Relude_Int.Eq), 5, 10)) |> toEqual(false)
expect(Identity.eq((module Relude.Int.Eq), 5, 10)) |> toEqual(false)
);
});
4 changes: 2 additions & 2 deletions __tests__/Relude_Int_test.re
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
open Jest;
open Expect;

module Int = Relude_Int;
module Int = Relude.Int;

describe("Int", () => {
test("toFloat", () =>
Expand Down Expand Up @@ -127,4 +127,4 @@ describe("Int", () => {
test("toString", () =>
expect(Int.toString(1)) |> toEqual("1")
);
});
});
6 changes: 3 additions & 3 deletions __tests__/Relude_Ior_test.re
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
open Jest;
open Expect;

module NonEmptyList = Relude_NonEmpty.List;
module Ior = Relude_Ior;
module NonEmptyList = Relude.NonEmpty.List;
module Ior = Relude.Ior;
open Ior;

module That = {
Expand Down Expand Up @@ -402,4 +402,4 @@ describe("Ior", () => {
|> toEqual(That(NonEmptyList.pure(That.Unknown)))
);
});
});
});
16 changes: 8 additions & 8 deletions __tests__/Relude_ListZipper_test.re
Original file line number Diff line number Diff line change
Expand Up @@ -307,13 +307,13 @@ describe("ListZipper", () => {
);

test("isAtItemBy", () =>
expect(LZ.make([2, 1], 3, []) |> LZ.isAtItemBy(Relude_Int.Eq.eq, 3))
expect(LZ.make([2, 1], 3, []) |> LZ.isAtItemBy(Relude.Int.Eq.eq, 3))
|> toEqual(true)
);

test("isAtItem", () =>
expect(
LZ.make([2, 1], 3, []) |> LZ.isAtItem((module Relude_Int.Eq), 3),
LZ.make([2, 1], 3, []) |> LZ.isAtItem((module Relude.Int.Eq), 3),
)
|> toEqual(true)
);
Expand Down Expand Up @@ -549,44 +549,44 @@ describe("ListZipper", () => {

test("findItemLeftBy", () =>
expect(
LZ.make([2, 1], 3, [4, 5]) |> LZ.findItemLeftBy(Relude_Int.Eq.eq, 1),
LZ.make([2, 1], 3, [4, 5]) |> LZ.findItemLeftBy(Relude.Int.Eq.eq, 1),
)
|> toEqual(Some(LZ.make([], 1, [2, 3, 4, 5])))
);

test("findItemRightBy", () =>
expect(
LZ.make([2, 1], 3, [4, 5]) |> LZ.findItemRightBy(Relude_Int.Eq.eq, 5),
LZ.make([2, 1], 3, [4, 5]) |> LZ.findItemRightBy(Relude.Int.Eq.eq, 5),
)
|> toEqual(Some(LZ.make([4, 3, 2, 1], 5, [])))
);

test("findItemBy", () =>
expect(
LZ.make([2, 1], 3, [4, 5]) |> LZ.findItemBy(Relude_Int.Eq.eq, 5),
LZ.make([2, 1], 3, [4, 5]) |> LZ.findItemBy(Relude.Int.Eq.eq, 5),
)
|> toEqual(Some(LZ.make([4, 3, 2, 1], 5, [])))
);

test("findItemLeft", () =>
expect(
LZ.make([2, 1], 3, [4, 5])
|> LZ.findItemLeft((module Relude_Int.Eq), 1),
|> LZ.findItemLeft((module Relude.Int.Eq), 1),
)
|> toEqual(Some(LZ.make([], 1, [2, 3, 4, 5])))
);

test("findItemRight", () =>
expect(
LZ.make([2, 1], 3, [4, 5])
|> LZ.findItemRight((module Relude_Int.Eq), 5),
|> LZ.findItemRight((module Relude.Int.Eq), 5),
)
|> toEqual(Some(LZ.make([4, 3, 2, 1], 5, [])))
);

test("findItem", () =>
expect(
LZ.make([2, 1], 3, [4, 5]) |> LZ.findItem((module Relude_Int.Eq), 5),
LZ.make([2, 1], 3, [4, 5]) |> LZ.findItem((module Relude.Int.Eq), 5),
)
|> toEqual(Some(LZ.make([4, 3, 2, 1], 5, [])))
);
Expand Down
14 changes: 7 additions & 7 deletions __tests__/Relude_List_test.re
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
open Jest;
open Expect;

module Int = Relude_Int;
module Int = Relude.Int;
module List = Relude.List;
module IO = Relude.IO;

Expand Down Expand Up @@ -556,11 +556,11 @@ describe("List", () => {
);

test("min empty", () =>
expect(List.min((module Relude_String.Ord), [])) |> toEqual(None)
expect(List.min((module Relude.String.Ord), [])) |> toEqual(None)
);

test("min many", () =>
expect(List.min((module Relude_String.Ord), ["b", "a", "c"]))
expect(List.min((module Relude.String.Ord), ["b", "a", "c"]))
|> toEqual(Some("a"))
);

Expand Down Expand Up @@ -762,7 +762,7 @@ describe("List", () => {
);

test("mapOption keep int", () =>
expect(List.mapOption(Relude_String.toInt, ["1", "a", "2", "", "3"]))
expect(List.mapOption(Relude.String.toInt, ["1", "a", "2", "", "3"]))
|> toEqual([1, 2, 3])
);

Expand Down Expand Up @@ -972,7 +972,7 @@ describe("List", () => {

test("Validation.traverse success", () =>
expect(List.Validation.traverse(a => Ok(a), [1, 2, 3, 4, 5]))
|> toEqual(Relude_Validation.VOk([1, 2, 3, 4, 5]))
|> toEqual(Relude.Validation.VOk([1, 2, 3, 4, 5]))
);

test("Validation.traverse failure", () =>
Expand All @@ -983,8 +983,8 @@ describe("List", () => {
),
)
|> toEqual(
Relude_Validation.VError(
Relude_NonEmpty.List.make(
Relude.Validation.VError(
Relude.NonEmpty.List.make(
"1 is bad",
["2 is bad", "3 is bad", "4 is bad", "5 is bad"],
),
Expand Down
Loading
Loading