Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
texodus committed Mar 6, 2023
1 parent 0b3a073 commit 981215c
Show file tree
Hide file tree
Showing 9 changed files with 83 additions and 29 deletions.
4 changes: 2 additions & 2 deletions packages/perspective-viewer-d3fc/test/results/results.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"events_perspective-config-update_event_is_fired_when_series_axis_is_changed": "a75579dc157424593d33efff7651db28",
"events_perspective-config-update_event_is_fired_when_series_axis_is_changed": "6ac5967822232cd80853f4f11eb614f1",
"events_perspective-config-update_event_is_fired_when_legend_position_is_changed": "01c7817ea82ab76f2a4d9ba47f5dce7a",
"__GIT_COMMIT__": "6941daaa3596b6d0d9e026c05bb9679525f4039e",
"__GIT_COMMIT__": "43dd81da00f8f42eb33d71f3e4aa6a436fdf8f8a",
"xyline_shows_a_grid_without_any_settings_applied": "2aba74b5e5db14953a041e7ebb544a8a",
"xyline_displays_visible_columns_": "c8bf1c32455f8f8a5210e6ba368ba3db",
"xyline_pivot_by_a_row": "6bb755705694cc8d7766c988fc98b8b4",
Expand Down
2 changes: 1 addition & 1 deletion packages/perspective/test/js/clear.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ module.exports = (perspective) => {
});
table.clear();
result = await view.to_columns();
expect(result).toEqual({});
expect(result).toEqual({ x: [] });
view.delete();
table.delete();
});
Expand Down
9 changes: 8 additions & 1 deletion packages/perspective/test/js/expressions/functionality.js
Original file line number Diff line number Diff line change
Expand Up @@ -1415,7 +1415,13 @@ module.exports = (perspective) => {
});

const result = await view.to_columns();
expect(result).toEqual({});
expect(result).toEqual({
'("w" + "x") * 10': [],
w: [],
x: [],
y: [],
z: [],
});

table.update(expressions_common.int_float_data);

Expand Down Expand Up @@ -2437,6 +2443,7 @@ module.exports = (perspective) => {
"8.5|y": [null, null, null, "d"],
"8.5|z": [null, null, null, false],
'8.5|"w" + "x"': [null, null, null, 8.5],
__ROW_PATH__: [],
});
view.delete();
table.delete();
Expand Down
45 changes: 25 additions & 20 deletions packages/perspective/test/js/expressions/multiple_views.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ module.exports = (perspective) => {
let result = await v1.to_columns();
let result2 = await v2.to_columns();

expect(result).toEqual({});
expect(result2).toEqual({});
expect(result).toEqual({ column: [], x: [], y: [], z: [] });
expect(result2).toEqual({ column: [], x: [], y: [], z: [] });

table.update(expressions_common.data);

Expand Down Expand Up @@ -77,8 +77,8 @@ module.exports = (perspective) => {
let result = await v1.to_columns();
let result2 = await v2.to_columns();

expect(result).toEqual({});
expect(result2).toEqual({});
expect(result).toEqual({ column: [], x: [], y: [], z: [] });
expect(result2).toEqual({ column: [], x: [], y: [], z: [] });

const expected = [];
const expected2 = [];
Expand Down Expand Up @@ -124,8 +124,8 @@ module.exports = (perspective) => {
let result = await v1.to_columns();
let result2 = await v2.to_columns();

expect(result).toEqual({});
expect(result2).toEqual({});
expect(result).toEqual({ column: [], x: [], y: [], z: [] });
expect(result2).toEqual({ column: [], x: [], y: [], z: [] });

const expected = [];
const expected2 = [];
Expand All @@ -143,7 +143,12 @@ module.exports = (perspective) => {
expected.push(i * 2);
expect(result["column"]).toEqual(expected);
} else {
expect(result).toEqual({});
expect(result).toEqual({
column: [],
x: [],
y: [],
z: [],
});
}

expected2.push(`A${i}BCD`);
Expand Down Expand Up @@ -175,8 +180,8 @@ module.exports = (perspective) => {
let result = await v1.to_columns();
let result2 = await v2.to_columns();

expect(result).toEqual({});
expect(result2).toEqual({});
expect(result).toEqual({ column: [], x: [], y: [], z: [] });
expect(result2).toEqual({ column: [], x: [], y: [], z: [] });

const expected = [];
const expected2 = [];
Expand Down Expand Up @@ -224,8 +229,8 @@ module.exports = (perspective) => {
let result = await v1.to_columns();
let result2 = await v2.to_columns();

expect(result).toEqual({});
expect(result2).toEqual({});
expect(result).toEqual({ column: [], x: [], y: [], z: [] });
expect(result2).toEqual({ column: [], x: [], y: [], z: [] });

table.update({
x: [2, 4, 3, 10, null],
Expand Down Expand Up @@ -271,8 +276,8 @@ module.exports = (perspective) => {
let result = await v1.to_columns();
let result2 = await v2.to_columns();

expect(result).toEqual({});
expect(result2).toEqual({});
expect(result).toEqual({ column: [], x: [], y: [], z: [] });
expect(result2).toEqual({ column: [], x: [], y: [], z: [] });

table.update({
x: [2, 4, 3, 10, null],
Expand Down Expand Up @@ -312,8 +317,8 @@ module.exports = (perspective) => {
let result = await v1.to_columns();
let result2 = await v2.to_columns();

expect(result).toEqual({});
expect(result2).toEqual({});
expect(result).toEqual({ column: [], x: [], y: [], z: [] });
expect(result2).toEqual({ column: [], x: [], y: [], z: [] });

table.update({
x: [2, 4, 3, 10, null],
Expand Down Expand Up @@ -375,8 +380,8 @@ module.exports = (perspective) => {
let result = await v1.to_columns();
let result2 = await v2.to_columns();

expect(result).toEqual({});
expect(result2).toEqual({});
expect(result).toEqual({ column: [], x: [], y: [], z: [] });
expect(result2).toEqual({ column: [], x: [], y: [], z: [] });

table.update({
x: [2, 4, 3, 10, null],
Expand Down Expand Up @@ -640,7 +645,7 @@ module.exports = (perspective) => {
console.log(result, result2);

expect(result["column"]).toEqual([8]);
expect(result2).toEqual({});
expect(result2).toEqual({ column: [], x: [], y: [], z: [] });

await v2.delete();
await v1.delete();
Expand Down Expand Up @@ -1025,8 +1030,8 @@ module.exports = (perspective) => {
result = await v1.to_columns();
result2 = await v2.to_columns();

expect(result).toEqual({});
expect(result2).toEqual({});
expect(result).toEqual({ column: [], column2: [] });
expect(result2).toEqual({ column: [], column2: [] });

await v2.delete();
await v1.delete();
Expand Down
2 changes: 2 additions & 0 deletions packages/perspective/test/js/pivots.js
Original file line number Diff line number Diff line change
Expand Up @@ -2362,6 +2362,7 @@ module.exports = (perspective) => {
}, {});

expect(result2).toEqual({
" ROW PATH ": [],
"4/11/2019, 11:40:35 PM|x": [null, null, 3, 4],
"4/11/2019, 11:40:35 PM|y": [null, null, "c", "d"],
"4/13/2019, 3:27:15 AM|x": [1, 2, null, null],
Expand Down Expand Up @@ -2430,6 +2431,7 @@ module.exports = (perspective) => {
});
let result2 = await view.to_columns();
expect(result2).toEqual({
__ROW_PATH__: [],
"true|w": [1.5, null, 3.5, null],
"true|x": [1, null, 3, null],
"true|y": ["a", null, "c", null],
Expand Down
6 changes: 5 additions & 1 deletion packages/perspective/test/js/removes.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,11 @@ describe("Removes", () => {
)
);

expect(await getter()).toEqual({});
expect(await getter()).toEqual({
float: [],
int: [],
str: [],
});

table.update({
str: ["def", "abc", "deff"],
Expand Down
31 changes: 31 additions & 0 deletions packages/perspective/test/js/sort.js
Original file line number Diff line number Diff line change
Expand Up @@ -569,6 +569,11 @@ module.exports = (perspective) => {
const paths = await view.column_paths();
expect(paths).toEqual(["d|w", "c|w", "b|w", "a|w"]);
const answer = {
__ROW_PATH__: [],
"a|x": [],
"b|x": [],
"c|x": [],
"d|x": [],
"d|w": [null, null, null, 4.5, null, null, null, 8.5],
"c|w": [null, null, 3.5, null, null, null, 7.5, null],
"b|w": [null, 2.5, null, null, null, 6.5, null, null],
Expand Down Expand Up @@ -597,6 +602,9 @@ module.exports = (perspective) => {

const result = await view.to_columns();
expect(result).toEqual({
__ROW_PATH__: [],
"a|y": [],
"b|y": [],
"a|x": [null, 1, 2, 3],
"b|x": [4, null, null, null],
});
Expand All @@ -620,6 +628,9 @@ module.exports = (perspective) => {

const result = await view.to_columns();
expect(result).toEqual({
__ROW_PATH__: [],
"a|y": [],
"b|y": [],
"b|x": [null, null, null, 4],
"a|x": [1, 2, 3, null],
});
Expand Down Expand Up @@ -650,6 +661,9 @@ module.exports = (perspective) => {

const result = await view.to_columns();
expect(result).toEqual({
__ROW_PATH__: [],
"a|y": [],
"b|y": [],
"a|x": [null, 1, 2, 3],
"b|x": [4, null, null, null],
});
Expand Down Expand Up @@ -679,6 +693,9 @@ module.exports = (perspective) => {

const result = await view.to_columns();
expect(result).toEqual({
__ROW_PATH__: [],
"a|y": [],
"b|y": [],
"b|x": [null, null, null, 4],
"a|x": [1, 2, 3, null],
});
Expand All @@ -704,6 +721,9 @@ module.exports = (perspective) => {

let result = await view.to_columns();
expect(result).toEqual({
__ROW_PATH__: [],
"a|y": [],
"b|y": [],
"b|x": [null, null, null, 4],
"a|x": [1, 2, 3, null],
});
Expand Down Expand Up @@ -755,6 +775,10 @@ module.exports = (perspective) => {
expect(paths).toEqual(["__ROW_PATH__", "x|z", "y|z"]);
const expected = {
__ROW_PATH__: [[], ["a"], ["b"], ["c"]],
"x|x": [],
"x|y": [],
"y|x": [],
"y|y": [],
"x|z": [7, 3, null, 4],
"y|z": [3, null, 3, null],
};
Expand Down Expand Up @@ -783,6 +807,10 @@ module.exports = (perspective) => {
expect(paths).toEqual(["__ROW_PATH__", "y|z", "x|z"]);
const expected = {
__ROW_PATH__: [[], ["c"], ["b"], ["a"]],
"x|x": [],
"x|y": [],
"y|x": [],
"y|y": [],
"y|z": [3, null, 3, null],
"x|z": [7, 4, null, 3],
};
Expand All @@ -808,8 +836,11 @@ module.exports = (perspective) => {
expect(paths).toEqual(["__ROW_PATH__", "a|z", "b|z", "c|z"]);
const expected = {
__ROW_PATH__: [[], ["x"], ["y"]],
"a|x": [],
"a|z": [3, 3, null],
"b|x": [],
"b|z": [3, null, 3],
"c|x": [],
"c|z": [4, 4, null],
};
const result = await view.to_columns();
Expand Down
5 changes: 5 additions & 0 deletions packages/perspective/test/js/to_format_viewport.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ describe("to_format viewport", function () {
const cols = await view.to_columns({ start_col: 1, end_col: 2 });
expect(cols).toEqual({
__ROW_PATH__: [[], ["a"], ["b"], ["c"], ["d"]],
w: [],
x: [40, 12, 12, 8, 8],
});
view.delete();
Expand Down Expand Up @@ -153,6 +154,7 @@ describe("to_format viewport", function () {
const cols = await view.to_columns({ start_col: 1, end_col: 2 });
expect(cols).toEqual({
__ROW_PATH__: [[], ["a"], ["b"], ["c"], ["d"]],
"false|w": [],
"false|x": [20, 4, 8, 1, 7],
});
view.delete();
Expand Down Expand Up @@ -184,6 +186,7 @@ describe("to_format viewport", function () {
});
const cols = await view.to_columns({ start_col: 0, end_col: 1 });
expect(cols).toEqual({
__ROW_PATH__: [],
"false|w": [
null,
2.5,
Expand Down Expand Up @@ -214,6 +217,7 @@ describe("to_format viewport", function () {
});
const cols = await view.to_columns({ start_col: 1, end_col: 2 });
expect(cols).toEqual({
"false|w": [],
"false|x": [
null,
2,
Expand Down Expand Up @@ -244,6 +248,7 @@ describe("to_format viewport", function () {
});
const cols = await view.to_columns({ start_col: 0, end_col: 2 });
expect(cols).toEqual({
__ROW_PATH__: [],
"false|w": [
null,
2.5,
Expand Down
8 changes: 4 additions & 4 deletions rust/perspective-viewer/test/results/results.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"superstore.html/doesn't leak elements.": "d0fd18b3d4d7c183c5ed155b4bf37972",
"superstore.html/doesn't leak views when setting group by.": "54daaa4bbbe59f6ed4acc301ba871bab",
"superstore.html/doesn't leak views when setting filters.": "6dfc1e505f1428424c3265f0236f22fc",
"__GIT_COMMIT__": "67f22cfe7d23a1ea74a1380a8c62e22c3c6e648a",
"__GIT_COMMIT__": "43dd81da00f8f42eb33d71f3e4aa6a436fdf8f8a",
"blank.html/Handles reloading with a schema.": "e58c62f6e0ff16dc4d753f99e0fc39c3",
"superstore_shows_a_grid_without_any_settings_applied_": "ae1c4690d978598ca14c8669244ce604",
"superstore_Responsive_Layout_shows_horizontal_columns_on_small_vertical_viewports_": "57ba3ad341cf8a0e4df6ab96715ff2a0",
Expand Down Expand Up @@ -62,9 +62,9 @@
"superstore_save()_returns_the_current_config": "ded04b5d6cb96a3651578334f189b20e",
"superstore_restore()_restores_a_config_from_save()": "ded04b5d6cb96a3651578334f189b20e",
"superstore_restore()_fires_the__perspective-config-update__event": "ded04b5d6cb96a3651578334f189b20e",
"superstore_restore_fires_the__perspective-config-update__event": "e0c3a5d479d8c0d6b46ef85c72b5858f",
"superstore_save_returns_the_current_config": "e0c3a5d479d8c0d6b46ef85c72b5858f",
"superstore_restore_restores_a_config_from_save": "e0c3a5d479d8c0d6b46ef85c72b5858f",
"superstore_restore_fires_the__perspective-config-update__event": "430bf6dcae53740a546985e79894487e",
"superstore_save_returns_the_current_config": "430bf6dcae53740a546985e79894487e",
"superstore_restore_restores_a_config_from_save": "430bf6dcae53740a546985e79894487e",
"Expressions_Click_on_add_column_button_opens_the_expression_UI_": "ecf14743de380a7e543c44ab15e6b1d7",
"Expressions_Resetting_the_viewer_partially_should_not_delete_all_expressions": "7c2f624e8dac7dd3df5ade4a49627d1c",
"Expressions_Resetting_the_viewer_partially_when_expression_as_in_columns_field,_should_not_delete_all_expressions": "7c2f624e8dac7dd3df5ade4a49627d1c",
Expand Down

0 comments on commit 981215c

Please sign in to comment.