Drop obsolete done callbacks in test/unit/annotation_storage_spec.js

There is no asynchronous code involved here, so we can get rid of all
done callbacks here and simply use the fact that if the function call
ends without failed assertion that the test passed.
This commit is contained in:
Tim van der Meij 2021-04-14 22:11:45 +02:00
parent 82bdba78fb
commit 046467ff47
No known key found for this signature in database
GPG Key ID: 8C3FD2925A5F2762

View File

@ -17,7 +17,7 @@ import { AnnotationStorage } from "../../src/display/annotation_storage.js";
describe("AnnotationStorage", function () {
describe("GetOrDefaultValue", function () {
it("should get and set a new value in the annotation storage", function (done) {
it("should get and set a new value in the annotation storage", function () {
const annotationStorage = new AnnotationStorage();
let value = annotationStorage.getValue("123A", {
value: "hello world",
@ -34,20 +34,18 @@ describe("AnnotationStorage", function () {
value: "an other string",
}).value;
expect(value).toEqual("hello world");
done();
});
});
describe("SetValue", function () {
it("should set a new value in the annotation storage", function (done) {
it("should set a new value in the annotation storage", function () {
const annotationStorage = new AnnotationStorage();
annotationStorage.setValue("123A", { value: "an other string" });
const value = annotationStorage.getAll()["123A"].value;
expect(value).toEqual("an other string");
done();
});
it("should call onSetModified() if value is changed", function (done) {
it("should call onSetModified() if value is changed", function () {
const annotationStorage = new AnnotationStorage();
let called = false;
const callback = function () {
@ -66,12 +64,11 @@ describe("AnnotationStorage", function () {
called = false;
annotationStorage.setValue("asdf", { value: "modified" });
expect(called).toBe(false);
done();
});
});
describe("ResetModified", function () {
it("should call onResetModified() if set", function (done) {
it("should call onResetModified() if set", function () {
const annotationStorage = new AnnotationStorage();
let called = false;
const callback = function () {
@ -92,7 +89,6 @@ describe("AnnotationStorage", function () {
annotationStorage.setValue("asdf", { value: "modified" });
annotationStorage.resetModified();
expect(called).toBe(true);
done();
});
});
});