Created
September 10, 2019 19:28
-
-
Save matthewp/6b3790f79a64bbe03ca7e22ce8ab1eb0 to your computer and use it in GitHub Desktop.
Fixtures and schema merging
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let RelativeDate = { | |
[Symbol.for("can.new")](value) { | |
if( date === "yesterday" ) { | |
return new Date()- 1000*24 | |
} | |
return date; | |
}, | |
[Symbol.for("can.isMember")](value) { | |
return value instanceof Date; | |
} | |
}; | |
let currentSchema = canReflect.getSchema(type.convertAll(Todo)); | |
let schema = { | |
...currentSchema, | |
keys: { | |
...currentSchema.keys, | |
dueDate: RelativeDate | |
} | |
}; | |
fixture.store(items, schema); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment