Skip to content

Commit 58eab61

Browse files
committed
Addition of SortOptions tests
1 parent 30bd468 commit 58eab61

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

tests/sort_options.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// Copyright (c) 2021 MC-Market (Mick Capital Pty. Ltd.)
2+
// MIT License (https://github.com/MC-Market-org/js-api-wrapper/blob/main/LICENSE)
3+
4+
const { SortOptions } = require("../src/SortOptions.js");
5+
6+
function single_sort() {
7+
let options = new SortOptions();
8+
options.sort = "purchases";
9+
10+
if (options.toQueryString() !== "?sort=purchases") {
11+
throw "single_sort() failed - expected did not match actual.";
12+
}
13+
}
14+
15+
function single_order() {
16+
let options = new SortOptions();
17+
options.order = "asc";
18+
19+
if (options.toQueryString() !== "?order=asc") {
20+
throw "single_order() failed - expected did not match actual.";
21+
}
22+
}
23+
24+
function single_page() {
25+
let options = new SortOptions();
26+
options.page = 5;
27+
28+
if (options.toQueryString() !== "?page=5") {
29+
throw "single_page() failed - expected did not match actual.";
30+
}
31+
}
32+
33+
single_sort();
34+
single_order();
35+
single_page();

tests/test.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,6 @@
22
// MIT License (https://github.com/MC-Market-org/js-api-wrapper/blob/main/LICENSE)
33

44
require("./base.js");
5+
require("./sort_options.js");
6+
57
throw "Test";

0 commit comments

Comments
 (0)