JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://code.jquery.com/qunit/qunit-2.1.1.js"></script>
<link rel="stylesheet" href="https://code.jquery.com/qunit/qunit-2.1.1.css">
<div id="qunit"></div>
<div id="qunit-fixture"></div>
JavaScript
QUnit.test("OK Test", function(assert) {
assert.ok(true);
assert.ok(true, "기본 메시지 = 결과가 true 이다");
assert.ok(true, "예살 결과 true");
});
QUnit.test("Equals Test", function(assert) {
assert.equal(1, true);
assert.equal(1, false);
assert.equal("1", 1);
assert.equal(1, 1);
assert.notEqual(1, true, "not equal");
});
QUnit.test("TestSuite", function(assert) {
//test data
var str1 = "abc";
var str2 = "abc";
var str3 = null;
var val1 = 5;
var val2 = 6;
var expectedArray = ["one", "two", "three"];
var resultArray = ["one", "two", "three"];
//Check that two objects are equal
assert.equal(str1, str2, "스트링 값이 같다");
//Check that two objects are not equal
assert.notEqual(str1, str3, "스트링 값이 같지 않다.");
//Check that a condition is true
assert.ok(val1 < val2, val1 + " 가 " + val2 + " 보다 작다.");
//Check that a condition is false
assert.notOk(val1 > val2, val2 + " 이 " + val1 + " 보다 크다 ");
//Check whether two arrays are equal to each other.
assert.deepEqual(expectedArray, resultArray, "Array type ?가 동일 하다.");
//Check whether two arrays are equal to each other.
assert.notDeepEqual(expectedArray, ["one", "two"], "Arrays passed are not equal.");
});
QUnit.module("group a");
QUnit.test("a basic test example", function(assert) {
assert.ok(true, "this test is fine");
});
QUnit.test("a basic test example 2", function(assert) {
assert.ok(true, "this test is fine");
});
QUnit.module("grouped tests argument hooks", function(hooks) {
hooks.beforeEach(function(assert) {
assert.ok(true, "beforeEach called");
});
hooks.afterEach(function(assert) {
assert.ok(true, "afterEach called");
});
QUnit.test("call hooks", function(assert) {
assert.expect(2);
});
QUnit.module("stacked hooks", function(hooks) {
// This will run after the parent module's beforeEach hook
hooks.beforeEach(function(assert) {
assert.ok(true, "nested beforeEach called");
});
// This will run before the parent...