mirror of
https://github.com/datashard/snapshot.git
synced 2024-12-22 01:47:35 +00:00
cleanup
This commit is contained in:
parent
5f861d4949
commit
b1ce5f2fdf
3 changed files with 14 additions and 13 deletions
|
@ -50,7 +50,7 @@ describe("datashard/snapshot", () => {
|
|||
"response": {
|
||||
"array": [0, 1, 2, "4"],
|
||||
"object": {
|
||||
// "with": "more details"
|
||||
"with": "more details"
|
||||
}
|
||||
},
|
||||
"thisisnew": "wtf"
|
||||
|
|
|
@ -21,6 +21,7 @@ const parseTextToJSON = (text) => text.replace(/\| [✅➖➕⭕]/g, "").trim().
|
|||
|
||||
const store_snapshot = (props = { value, name, raiser }) => {
|
||||
if (Cypress.env().updateSnapshots || Cypress.config('snapshot').updateSnapshots) {
|
||||
cy.SNAPSHOT_prettyprint({ title: "INFO", type: "info", message: "Saving Snapshot" })
|
||||
cy.writeFile(`${props.name}.json`, JSON.stringify(props.value, null, 2))
|
||||
} else {
|
||||
// TODO: Figure out how to replace the fixture folder name if people move it
|
||||
|
@ -35,11 +36,16 @@ const set_snapshot = ({ snapshotName, serialized, value }) => {
|
|||
devToolsLog.$el = value;
|
||||
}
|
||||
|
||||
let options = {
|
||||
name: "snapshot",
|
||||
message: snapshotName,
|
||||
consoleProps: () => { return devToolsLog },
|
||||
};
|
||||
|
||||
if (value) options.$el = value;
|
||||
|
||||
const raiser = ({ value, expected }) => {
|
||||
const result = compareValues({ expected, value });
|
||||
// console.log("Final Result", result.result)
|
||||
if ((!Cypress.env().updateSnapshots || !Cypress.config('snapshot').updateSnapshots) && !result.success) {
|
||||
devToolsLog = () => {
|
||||
return { expected, value }
|
||||
|
@ -51,18 +57,16 @@ const set_snapshot = ({ snapshotName, serialized, value }) => {
|
|||
Cypress.log({ message: error(true) })
|
||||
|
||||
throw new Error(error());
|
||||
} else {
|
||||
cy.SNAPSHOT_prettyprint({
|
||||
title: "SUCCESS",
|
||||
message: snapshotName,
|
||||
type: "success"
|
||||
})
|
||||
}
|
||||
};
|
||||
|
||||
let options = {
|
||||
name: "snapshot",
|
||||
message: snapshotName,
|
||||
consoleProps: () => { return devToolsLog },
|
||||
};
|
||||
|
||||
if (value) options.$el = value;
|
||||
|
||||
Cypress.log(options);
|
||||
|
||||
store_snapshot({
|
||||
value,
|
||||
|
|
|
@ -30,9 +30,6 @@ const compare = (expected, value) => {
|
|||
dataY = expected;
|
||||
}
|
||||
|
||||
console.log('datax', dataX)
|
||||
console.log('dataY', dataY)
|
||||
|
||||
dataX.forEach(function (item, index) {
|
||||
const resultset = compare(item, dataY[index]);
|
||||
compareResult += resultset.result;
|
||||
|
|
Loading…
Reference in a new issue