Skip to content

Commit

Permalink
fix(frontend): adjust workdays transform (#287)
Browse files Browse the repository at this point in the history
  • Loading branch information
c0rydoras authored Jun 19, 2024
1 parent 3268c3b commit 944ace0
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions frontend/app/transforms/django-workdays.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export default class DjangoWorkdaysTransform extends Transform {
* @public
*/
deserialize(serialized) {
return serialized.map(Number);
return serialized.split(",").map(Number);
}

/**
Expand All @@ -31,6 +31,6 @@ export default class DjangoWorkdaysTransform extends Transform {
* @public
*/
serialize(deserialized) {
return deserialized.map(String);
return deserialized.join();
}
}
2 changes: 1 addition & 1 deletion frontend/mirage/factories/location.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ import { Factory } from "miragejs";

export default Factory.extend({
name: () => faker.address.city(),
workdays: () => ["1", "2", "3", "4", "5"],
workdays: () => "1,2,3,4,5",
});
4 changes: 2 additions & 2 deletions frontend/tests/unit/transforms/django-workdays-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ module("Unit | Transform | django workdays", function (hooks) {

const result = transform.serialize([1, 2, 3, 4, 5]);

assert.deepEqual(result, ["1", "2", "3", "4", "5"]);
assert.deepEqual(result, "1,2,3,4,5");
});

test("deserializes", function (assert) {
const transform = this.owner.lookup("transform:django-workdays");

const result = transform.deserialize(["1", "2", "3", "4", "5"]);
const result = transform.deserialize("1,2,3,4,5");

assert.deepEqual(result, [1, 2, 3, 4, 5]);
});
Expand Down

0 comments on commit 944ace0

Please sign in to comment.