Skip to content

Commit

Permalink
drop invalid put test
Browse files Browse the repository at this point in the history
  • Loading branch information
benjamincburns committed Oct 18, 2024
1 parent 0e1fd27 commit a061cbc
Showing 1 changed file with 0 additions and 43 deletions.
43 changes: 0 additions & 43 deletions libs/checkpoint-validation/src/spec/put.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,10 @@ export function putTests<T extends BaseCheckpointSaver>(
let initializerConfig: RunnableConfig;
let thread_id: string;
let checkpoint_id1: string;
let checkpoint_id2: string;
let invalid_checkpoint_id: string;

beforeEach(async () => {
thread_id = uuid6(-3);
checkpoint_id1 = uuid6(-3);
checkpoint_id2 = uuid6(-3);
invalid_checkpoint_id = uuid6(-3);

const baseConfig = {
configurable: {
Expand All @@ -51,14 +47,10 @@ export function putTests<T extends BaseCheckpointSaver>(
let configArgument: RunnableConfig;
let checkpointStoredWithoutIdInConfig: Checkpoint;
let metadataStoredWithoutIdInConfig: CheckpointMetadata | undefined;
let checkpointStoredWithIdInConfig: Checkpoint;
let metadataStoredWithIdInConfig: CheckpointMetadata | undefined;

describe("success cases", () => {
let basicPutReturnedConfig: RunnableConfig;
let checkpointIdCheckReturnedConfig: RunnableConfig;
let basicPutRoundTripTuple: CheckpointTuple | undefined;
let checkpointIdCheckRoundTripTuple: CheckpointTuple | undefined;

beforeEach(async () => {
({
Expand All @@ -70,15 +62,6 @@ export function putTests<T extends BaseCheckpointSaver>(
checkpoint_ns,
}));

({
checkpoint: checkpointStoredWithIdInConfig,
metadata: metadataStoredWithIdInConfig,
} = initialCheckpointTuple({
config: initializerConfig,
checkpoint_id: checkpoint_id2,
checkpoint_ns,
}));

configArgument = mergeConfigs(initializerConfig, {
configurable: { checkpoint_ns },
});
Expand Down Expand Up @@ -117,26 +100,9 @@ export function putTests<T extends BaseCheckpointSaver>(
{}
);

// call put with a different `checkpoint_id` in the config to ensure that it treats the `id` field in the `Checkpoint` as
// the authoritative identifier, rather than the `checkpoint_id` in the config
checkpointIdCheckReturnedConfig = await saver.put(
mergeConfigs(configArgument, {
configurable: {
checkpoint_id: invalid_checkpoint_id,
},
}),
checkpointStoredWithIdInConfig,
metadataStoredWithIdInConfig!,
{}
);

basicPutRoundTripTuple = await saver.getTuple(
mergeConfigs(configArgument, basicPutReturnedConfig)
);

checkpointIdCheckRoundTripTuple = await saver.getTuple(
mergeConfigs(configArgument, checkpointIdCheckReturnedConfig)
);
});

it("should return a config with a 'configurable' property", () => {
Expand Down Expand Up @@ -165,9 +131,6 @@ export function putTests<T extends BaseCheckpointSaver>(
expect(basicPutReturnedConfig.configurable?.checkpoint_id).toEqual(
checkpointStoredWithoutIdInConfig.id
);
expect(
checkpointIdCheckReturnedConfig.configurable?.checkpoint_id
).toEqual(checkpointStoredWithIdInConfig.id);
});

it("should return config with matching checkpoint_ns", () => {
Expand All @@ -186,12 +149,6 @@ export function putTests<T extends BaseCheckpointSaver>(
);
});

it("should return a checkpoint with a new id when the id in the config on put is invalid", () => {
expect(checkpointIdCheckRoundTripTuple?.checkpoint.id).not.toEqual(
invalid_checkpoint_id
);
});

it("should store the metadata without alteration", () => {
expect(basicPutRoundTripTuple?.metadata).toEqual(
metadataStoredWithoutIdInConfig
Expand Down

0 comments on commit a061cbc

Please sign in to comment.