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

Landscaper: QUnit2 upgrade #60

Merged
merged 2 commits into from
May 24, 2019
Merged
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"http-server": "^0.11.0",
"jshint": "^2.9.5",
"steal": "^1.5.14",
"steal-qunit": "^1.0.0",
"steal-qunit": "^2.0.0",
"steal-tools": "^1.9.0",
"testee": "^0.9.0"
},
Expand Down
46 changes: 23 additions & 23 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ defineValidate(NoConstraints);

QUnit.module("can-define-validate-validatejs");

QUnit.test("when constraints missing", function() {
QUnit.test("when constraints missing", function(assert) {
var locator = new NoConstraints();
QUnit.notOk(locator.errors(), "runs but returns no errors");
assert.notOk(locator.errors(), "runs but returns no errors");
});

QUnit.test("errors is readable when wrapped as compute", function() {
QUnit.test("errors is readable when wrapped as compute", function(assert) {
var locator = new Locator({ city: "angier", state: "NC" });
var errors = compute(function() {
return locator.errors();
Expand All @@ -50,7 +50,7 @@ QUnit.test("errors is readable when wrapped as compute", function() {
}
];
errors.on("change", function(ev, errors) {
QUnit.deepEqual(
assert.deepEqual(
errors,
expectedErrors,
"Errors are set based on constraints"
Expand All @@ -60,15 +60,15 @@ QUnit.test("errors is readable when wrapped as compute", function() {
locator.state = "Juan";
});

QUnit.test("errors is readable when wrapped as compute", function() {
QUnit.test("errors is readable when wrapped as compute", function(assert) {
var locator = new Locator({ city: "angier", state: "NC", zipCode: 27501 });
var errors = compute(function() {
return locator.errors();
});
var counter = 0;
errors.on("change", function(ev, errors) {
if (counter > 0) {
QUnit.notOk(errors, "Errors update when values change");
assert.notOk(errors, "Errors update when values change");
}
counter++;
});
Expand All @@ -77,7 +77,7 @@ QUnit.test("errors is readable when wrapped as compute", function() {
locator.state = "CA";
});

QUnit.test("calling errors returns object", function() {
QUnit.test("calling errors returns object", function(assert) {
var locator = new Locator({ city: "angier" });
var expectedErrors = [
{
Expand All @@ -89,13 +89,13 @@ QUnit.test("calling errors returns object", function() {
related: ["zipCode"]
}
];
QUnit.deepEqual(locator.errors(), expectedErrors, "Returns error type array");
assert.deepEqual(locator.errors(), expectedErrors, "Returns error type array");
});

QUnit.test("calling errors with string returns error for that key", function() {
QUnit.test("calling errors with string returns error for that key", function(assert) {
var locator = new Locator({ city: "angier" });
var errors = locator.errors("state");
QUnit.deepEqual(errors, [
assert.deepEqual(errors, [
{
message: "can't be blank",
related: ["state"]
Expand All @@ -105,14 +105,14 @@ QUnit.test("calling errors with string returns error for that key", function() {

QUnit.test(
"calling errors with string returns undefined when no errors are set",
function() {
function(assert) {
var locator = new Locator({ city: "angier", state: "NC", zipCode: 27501 });
var errors = locator.errors("state");
QUnit.notOk(errors, "Errors is undefined");
assert.notOk(errors, "Errors is undefined");
}
);

QUnit.test("errors with object returns errors for requested keys", function() {
QUnit.test("errors with object returns errors for requested keys", function(assert) {
var locator = new Locator({ city: "angier" });
var expectedErrors = [
{
Expand All @@ -124,10 +124,10 @@ QUnit.test("errors with object returns errors for requested keys", function() {
related: ["zipCode"]
}
];
QUnit.deepEqual(locator.errors("state", "zipCode"), expectedErrors);
assert.deepEqual(locator.errors("state", "zipCode"), expectedErrors);
});

QUnit.test("testSet a single value", function() {
QUnit.test("testSet a single value", function(assert) {
var locator = new Locator({ city: "angier", state: "nc", zipCode: 27501 });
var expectedErrors = [
{
Expand All @@ -140,11 +140,11 @@ QUnit.test("testSet a single value", function() {
}
];
var errors = locator.testSet("state", "");
QUnit.deepEqual(errors, expectedErrors, "returns correct error");
QUnit.notOk(locator.errors(), "Does not set errors on map");
assert.deepEqual(errors, expectedErrors, "returns correct error");
assert.notOk(locator.errors(), "Does not set errors on map");
});

QUnit.test("testSet many values", function() {
QUnit.test("testSet many values", function(assert) {
var locator = new Locator({ city: "angier", state: "nc", zipCode: 27501 });
var errors = locator.testSet({ state: "", zipCode: "" });
var expectedErrors = [
Expand All @@ -165,11 +165,11 @@ QUnit.test("testSet many values", function() {
related: ["zipCode"]
}
];
QUnit.deepEqual(errors, expectedErrors, "returns correct error");
QUnit.notOk(locator.errors(), "Does not set errors on map");
assert.deepEqual(errors, expectedErrors, "returns correct error");
assert.notOk(locator.errors(), "Does not set errors on map");
});

QUnit.test("testSet many values, with clean map", function() {
QUnit.test("testSet many values, with clean map", function(assert) {
var locator = new Locator({ city: "angier", state: "nc", zipCode: 27501 });
var errors = locator.testSet({ state: "" }, true);
var expectedErrors = [
Expand All @@ -190,6 +190,6 @@ QUnit.test("testSet many values, with clean map", function() {
related: ["zipCode"]
}
];
QUnit.deepEqual(errors, expectedErrors, "returns correct error");
QUnit.notOk(locator.errors(), "Does not set errors on map");
assert.deepEqual(errors, expectedErrors, "returns correct error");
assert.notOk(locator.errors(), "Does not set errors on map");
});